plateforme-tfjm2/apps/member/admin.py

57 lines
1.4 KiB
Python

from django.contrib.auth.admin import admin
from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin
from member.models import TFJMUser, Document, Solution, Synthesis, MotivationLetter, Authorization, Config
@admin.register(TFJMUser)
class TFJMUserAdmin(admin.ModelAdmin):
"""
Django admin page for users.
"""
list_display = ('email', 'first_name', 'last_name', 'role', )
search_fields = ('last_name', 'first_name',)
@admin.register(Document)
class DocumentAdmin(PolymorphicParentModelAdmin):
"""
Django admin page for any documents.
"""
child_models = (Authorization, MotivationLetter, Solution, Synthesis,)
polymorphic_list = True
@admin.register(Authorization)
class AuthorizationAdmin(PolymorphicChildModelAdmin):
"""
Django admin page for Authorization.
"""
@admin.register(MotivationLetter)
class MotivationLetterAdmin(PolymorphicChildModelAdmin):
"""
Django admin page for Motivation letters.
"""
@admin.register(Solution)
class SolutionAdmin(PolymorphicChildModelAdmin):
"""
Django admin page for solutions.
"""
@admin.register(Synthesis)
class SynthesisAdmin(PolymorphicChildModelAdmin):
"""
Django admin page for syntheses.
"""
@admin.register(Config)
class ConfigAdmin(admin.ModelAdmin):
"""
Django admin page for configurations.
"""