Skip to content

Commit

Permalink
Merge pull request #493 from battlecode/jerrym-export-data
Browse files Browse the repository at this point in the history
Enable team and user data export
  • Loading branch information
j-mao authored Jan 9, 2023
2 parents 9dff1ae + ec0e0c7 commit 5f7ab58
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions backend/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies:
- django-anymail==8.6
- django-configurations==2.4
- django-countries==7.4.2
- django-import-export==3.0.2
- django-sortedm2m==3.1.1
- django-storages[google]==1.13.1
- django-structlog==4.0.1
Expand Down
3 changes: 2 additions & 1 deletion backend/siarnaq/api/teams/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin
from import_export.admin import ExportMixin

from siarnaq.api.compete.models import MatchParticipant, Submission
from siarnaq.api.teams.models import Team, TeamProfile
Expand Down Expand Up @@ -76,7 +77,7 @@ def status(self, obj):


@admin.register(Team)
class TeamAdmin(admin.ModelAdmin):
class TeamAdmin(ExportMixin, admin.ModelAdmin):
fields = ("name", "episode", "status", "members", "join_key")
inlines = [TeamProfileInline, SubmissionInline, MatchParticipantInline]
list_display = ("name", "episode", "rating", "status")
Expand Down
3 changes: 2 additions & 1 deletion backend/siarnaq/api/user/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django_rest_passwordreset.models import ResetPasswordToken
from import_export.admin import ExportMixin

from siarnaq.api.teams.models import Team
from siarnaq.api.user.forms import UserCreationForm
Expand Down Expand Up @@ -48,7 +49,7 @@ def episode(self, obj):


@admin.register(User)
class UserAdmin(BaseUserAdmin):
class UserAdmin(ExportMixin, BaseUserAdmin):
add_form = UserCreationForm
add_fieldsets = (
(
Expand Down
1 change: 1 addition & 0 deletions backend/siarnaq/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class Base(Configuration):
"drf_spectacular",
"django_rest_passwordreset",
"anymail",
"import_export",
"sortedm2m",
"siarnaq.api.user",
"siarnaq.api.compete",
Expand Down
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies:
- django-anymail==8.6
- django-configurations==2.4
- django-countries==7.4.2
- django-import-export==3.0.2
- django-sortedm2m==3.1.1
- django-storages[google]==1.13.1
- django-structlog==4.0.1
Expand Down

0 comments on commit 5f7ab58

Please sign in to comment.