mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2024-12-05 02:06:52 +00:00
Add admin pages for Participation app
This commit is contained in:
parent
dee2152616
commit
4043d04826
@ -0,0 +1,46 @@
|
||||
from django.contrib import admin
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from .models import Participation, Phase, Question, Team, Video
|
||||
|
||||
|
||||
@admin.register(Team)
|
||||
class TeamAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'trigram', 'problem', 'valid',)
|
||||
search_fields = ('name', 'trigram',)
|
||||
list_filter = ('participation__problem', 'participation__valid',)
|
||||
|
||||
def problem(self, team):
|
||||
return team.participation.get_problem_display()
|
||||
|
||||
problem.short_description = _('problem number')
|
||||
|
||||
def valid(self, team):
|
||||
return team.participation.valid
|
||||
|
||||
valid.short_description = _('valid')
|
||||
|
||||
|
||||
@admin.register(Participation)
|
||||
class ParticipationAdmin(admin.ModelAdmin):
|
||||
list_display = ('team', 'problem', 'valid',)
|
||||
search_fields = ('team__name', 'team__trigram',)
|
||||
list_filter = ('problem', 'valid',)
|
||||
|
||||
|
||||
@admin.register(Video)
|
||||
class VideoAdmin(admin.ModelAdmin):
|
||||
list_display = ('participation', 'link',)
|
||||
search_fields = ('participation__team__name', 'participation__team__trigram', 'link',)
|
||||
|
||||
|
||||
@admin.register(Question)
|
||||
class QuestionAdmin(admin.ModelAdmin):
|
||||
list_display = ('participation', 'question',)
|
||||
search_fields = ('participation__team__name', 'participation__team__trigram', 'question',)
|
||||
|
||||
|
||||
@admin.register(Phase)
|
||||
class PhaseAdmin(admin.ModelAdmin):
|
||||
list_display = ('phase_number', 'start', 'end',)
|
||||
ordering = ('phase_number', 'start',)
|
Loading…
Reference in New Issue
Block a user