mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 16:22:22 +00:00
1d81213773
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
# Copyright (C) 2020 by Animath
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from django.contrib import admin
|
|
from django.contrib.admin import ModelAdmin
|
|
from polymorphic.admin import PolymorphicChildModelAdmin, PolymorphicParentModelAdmin
|
|
|
|
from .models import CoachRegistration, Payment, Registration, StudentRegistration, VolunteerRegistration
|
|
|
|
|
|
@admin.register(Registration)
|
|
class RegistrationAdmin(PolymorphicParentModelAdmin):
|
|
child_models = (StudentRegistration, CoachRegistration, VolunteerRegistration,)
|
|
list_display = ("user", "type", "email_confirmed",)
|
|
polymorphic_list = True
|
|
|
|
|
|
@admin.register(StudentRegistration)
|
|
class StudentRegistrationAdmin(PolymorphicChildModelAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(CoachRegistration)
|
|
class CoachRegistrationAdmin(PolymorphicChildModelAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(VolunteerRegistration)
|
|
class VolunteerRegistrationAdmin(PolymorphicChildModelAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(Payment)
|
|
class PaymentAdmin(ModelAdmin):
|
|
list_display = ('registration', 'type', 'valid', )
|
|
search_fields = ('registration__user__last_name', 'registration__user__first_name', 'registration__user__email',)
|
|
list_filter = ('type', 'valid',)
|