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
|
2021-01-21 21:22:21 +00:00
|
|
|
from django.contrib.admin import ModelAdmin
|
2020-12-27 10:49:54 +00:00
|
|
|
from polymorphic.admin import PolymorphicChildModelAdmin, PolymorphicParentModelAdmin
|
|
|
|
|
2023-02-19 23:23:18 +00:00
|
|
|
from .models import CoachRegistration, Payment, Registration, StudentRegistration, VolunteerRegistration
|
2020-12-27 10:49:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Registration)
|
|
|
|
class RegistrationAdmin(PolymorphicParentModelAdmin):
|
2023-02-19 23:23:18 +00:00
|
|
|
child_models = (StudentRegistration, CoachRegistration, VolunteerRegistration,)
|
2020-12-27 10:49:54 +00:00
|
|
|
list_display = ("user", "type", "email_confirmed",)
|
|
|
|
polymorphic_list = True
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(StudentRegistration)
|
|
|
|
class StudentRegistrationAdmin(PolymorphicChildModelAdmin):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(CoachRegistration)
|
|
|
|
class CoachRegistrationAdmin(PolymorphicChildModelAdmin):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2023-02-19 23:23:18 +00:00
|
|
|
@admin.register(VolunteerRegistration)
|
|
|
|
class VolunteerRegistrationAdmin(PolymorphicChildModelAdmin):
|
2020-12-27 10:49:54 +00:00
|
|
|
pass
|
2021-01-21 21:22:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
@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',)
|