plateforme-tfjm2/apps/participation/admin.py

60 lines
1.6 KiB
Python
Raw Normal View History

2020-12-27 10:49:54 +00:00
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
2021-04-09 14:17:12 +00:00
from .models import Note, Participation, Passage, Pool, Solution, Synthesis, Team, Tournament
2020-12-27 10:49:54 +00:00
@admin.register(Team)
class TeamAdmin(admin.ModelAdmin):
2020-12-28 17:52:50 +00:00
list_display = ('name', 'trigram', 'valid',)
2020-12-27 10:49:54 +00:00
search_fields = ('name', 'trigram',)
2020-12-28 17:52:50 +00:00
list_filter = ('participation__valid',)
2020-12-27 10:49:54 +00:00
def valid(self, team):
return team.participation.valid
valid.short_description = _('valid')
@admin.register(Participation)
class ParticipationAdmin(admin.ModelAdmin):
2020-12-28 17:52:50 +00:00
list_display = ('team', 'valid',)
2020-12-27 10:49:54 +00:00
search_fields = ('team__name', 'team__trigram',)
2020-12-28 17:52:50 +00:00
list_filter = ('valid',)
@admin.register(Pool)
class PoolAdmin(admin.ModelAdmin):
search_fields = ('participations__team__name', 'participations__team__trigram',)
2020-12-27 10:49:54 +00:00
2021-01-21 21:22:21 +00:00
@admin.register(Passage)
class PassageAdmin(admin.ModelAdmin):
search_fields = ('pool__participations__team__name', 'pool__participations__team__trigram',)
2021-04-09 14:17:12 +00:00
@admin.register(Note)
class NoteAdmin(admin.ModelAdmin):
search_fields = ('jury',)
2020-12-28 17:52:50 +00:00
@admin.register(Solution)
class SolutionAdmin(admin.ModelAdmin):
list_display = ('participation',)
search_fields = ('participation__team__name', 'participation__team__trigram',)
2020-12-27 10:49:54 +00:00
2020-12-28 17:52:50 +00:00
@admin.register(Synthesis)
class SynthesisAdmin(admin.ModelAdmin):
list_display = ('participation',)
search_fields = ('participation__team__name', 'participation__team__trigram',)
2020-12-27 10:49:54 +00:00
2020-12-28 17:52:50 +00:00
@admin.register(Tournament)
class TournamentAdmin(admin.ModelAdmin):
list_display = ('name',)
search_fields = ('name',)