mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-24 04:28:48 +02:00
Restructure payment model
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -97,11 +97,12 @@ class VolunteerRegistrationAdmin(PolymorphicChildModelAdmin):
|
||||
|
||||
@admin.register(Payment)
|
||||
class PaymentAdmin(ModelAdmin):
|
||||
list_display = ('registration', 'registration_type', 'type', 'valid', )
|
||||
search_fields = ('registration__user__last_name', 'registration__user__first_name', 'registration__user__email',)
|
||||
list_filter = ('registration__team__participation__valid', 'type', 'type', 'valid',)
|
||||
autocomplete_fields = ('registration',)
|
||||
list_display = ('id', 'concerned_people', 'grouped', 'type', 'valid', )
|
||||
search_fields = ('registrations__user__last_name', 'registrations__user__first_name', 'registrations__user__email',)
|
||||
list_filter = ('registrations__team__participation__valid', 'type',
|
||||
'grouped', 'valid', 'registrations__polymorphic_ctype',)
|
||||
autocomplete_fields = ('registrations',)
|
||||
|
||||
@admin.display(description=_('registration type'), ordering='registration__polymorphic_ctype')
|
||||
def registration_type(self, record: Payment):
|
||||
return record.registration.get_real_instance().type
|
||||
@admin.display(description=_('concerned people'))
|
||||
def concerned_people(self, record: Payment):
|
||||
return ", ".join(f"{reg.user.first_name} {reg.user.last_name}" for reg in record.registrations.all())
|
||||
|
Reference in New Issue
Block a user