-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Algo-Sports/revert-29-revert-20-feat/game…
…s-api Revert "Revert "Feat/games api""
- Loading branch information
Showing
45 changed files
with
2,029 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
match_datas | ||
|
||
### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,71 @@ | ||
from django.contrib import admin | ||
|
||
from .models import CodeRoomRelation, JudgementCode, ProgrammingLanguage, UserCode | ||
from .models import JudgementCode, MatchCodeRelation, ProgrammingLanguage, UserCode | ||
|
||
|
||
@admin.register(ProgrammingLanguage) | ||
class ProgrammingLanguageAdmin(admin.ModelAdmin): | ||
list_display = ("id", "name") | ||
search_fields = ("name",) | ||
list_filter = ("is_active",) | ||
|
||
|
||
@admin.register(UserCode) | ||
class UserCodeAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
"id", | ||
"user_id", | ||
"programming_language", | ||
"code", | ||
"is_active", | ||
"created_at", | ||
"updated_at", | ||
) | ||
list_filter = ("user_id", "programming_language", "created_at", "updated_at") | ||
search_fields = ["author"] | ||
raw_id_fields = ("gamerooms",) | ||
date_hierarchy = "created_at" | ||
# list_display = ( | ||
# "id", | ||
# "user_id", | ||
# "programming_language", | ||
# "code", | ||
# "is_active", | ||
# "created_at", | ||
# "updated_at", | ||
# ) | ||
# list_filter = ("user_id", "programming_language", "created_at", "updated_at") | ||
# search_fields = ["author"] | ||
# raw_id_fields = ("gamematchs",) | ||
# date_hierarchy = "created_at" | ||
|
||
def author(self, obj): | ||
return obj.user.username | ||
# def author(self, obj): | ||
# return obj.user.username | ||
pass | ||
|
||
|
||
@admin.register(JudgementCode) | ||
class JudgementCodeAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
"id", | ||
"user_id", | ||
"gameinfo_id", | ||
"programming_language", | ||
"code", | ||
"created_at", | ||
"updated_at", | ||
) | ||
list_filter = ( | ||
"user_id", | ||
"gameinfo_id", | ||
"programming_language", | ||
"created_at", | ||
"updated_at", | ||
) | ||
search_fields = ("author", "gameinfo__title") | ||
date_hierarchy = "created_at" | ||
# list_display = ( | ||
# "id", | ||
# "user_id", | ||
# "gameinfo_id", | ||
# "programming_language", | ||
# "code", | ||
# "created_at", | ||
# "updated_at", | ||
# ) | ||
# list_filter = ( | ||
# "user_id", | ||
# "gameinfo_id", | ||
# "programming_language", | ||
# "created_at", | ||
# "updated_at", | ||
# ) | ||
# search_fields = ("author", "gameinfo__title") | ||
# date_hierarchy = "created_at" | ||
|
||
def author(self, obj): | ||
return obj.user.username | ||
# def author(self, obj): | ||
# return obj.user.username | ||
pass | ||
|
||
|
||
@admin.register(CodeRoomRelation) | ||
class CodeRoomRelationAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
"id", | ||
"usercode_id", | ||
"gameroom_id", | ||
"score", | ||
"history", | ||
"created_at", | ||
"updated_at", | ||
) | ||
list_filter = ("usercode_id", "gameroom_id", "created_at", "updated_at") | ||
date_hierarchy = "created_at" | ||
@admin.register(MatchCodeRelation) | ||
class MatchCodeRelationAdmin(admin.ModelAdmin): | ||
# list_display = ( | ||
# "id", | ||
# "usercode_id", | ||
# "gamematch_id", | ||
# "created_at", | ||
# "updated_at", | ||
# ) | ||
# list_filter = ("usercode_id", "gamematch_id", "created_at", "updated_at") | ||
# date_hierarchy = "created_at" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,6 @@ class Meta: | |
model = JudgementCode | ||
fields = ( | ||
"user", | ||
"gameinfo_id", | ||
"gameversion_id", | ||
"programming_language", | ||
) |
Oops, something went wrong.