Skip to content

Commit

Permalink
Merge pull request #30 from Algo-Sports/revert-29-revert-20-feat/game…
Browse files Browse the repository at this point in the history
…s-api

Revert "Revert "Feat/games api""
  • Loading branch information
Aqudi authored Dec 13, 2020
2 parents b57b8b8 + f15fcb4 commit fadcddb
Show file tree
Hide file tree
Showing 45 changed files with 2,029 additions and 194 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
match_datas

### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,29 @@
pip install -r requirements/local.txt
```

### Start local server
### Utility

- 아래 커맨드로 확인 가능

```shell
python manage.py runserver
fab -l
```

### Start local server

- API 서버
```shell
fab runserver
```
- Celery broker
```shell
redis-server
```
- Celery worker
```shell
fab celery
```

### Test

```shell
Expand Down
100 changes: 51 additions & 49 deletions algo_sports/codes/admin.py
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
2 changes: 1 addition & 1 deletion algo_sports/codes/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ class Meta:
model = JudgementCode
fields = (
"user",
"gameinfo_id",
"gameversion_id",
"programming_language",
)
Loading

0 comments on commit fadcddb

Please sign in to comment.