1 from django.contrib import admin
2 from django.utils.translation import gettext_lazy as _
3 from django.utils.timezone import now
4 from fnpdjango.actions import export_as_csv_action
9 admin.site.register(models.Fundraiser)
10 admin.site.register(models.Campaign)
12 @admin.register(models.DirectDebit)
13 class DirectDebitAdmin(admin.ModelAdmin):
15 'payment_id', 'acquisition_date',
17 'bank_submission_date',
18 'bank_acceptance_date',
19 'amount', 'first_name', 'last_name',
21 date_hierarchy = 'acquisition_date'
23 'payment_id', 'first_name', 'last_name', 'street', 'building', 'town', 'flat',
24 'phone', 'email', 'iban',
44 ('first_name', 'sex', 'date_of_birth'),
46 ('street', 'building'),
48 ('postal_code', 'phone'),
50 ('iban', 'iban_valid', 'iban_warning'),
55 ('acquisition_date', 'amount'),
61 (_('Processing'), {"fields": [
62 ('is_cancelled', 'needs_redo', 'optout'),
64 'fundraiser_commission',
66 'bank_submission_date',
67 'bank_acceptance_date',
72 readonly_fields = ['agree_contact', 'iban_valid', 'iban_warning']
74 def set_bank_submission(m,r,q):
75 q.update(bank_submission_date=now())
79 export_as_csv_action(),
82 def agree_contact(self, obj):
83 return _('obligatory')
84 agree_contact.short_description = _('agree contact')
86 def get_changeform_initial_data(self, request):
88 'payment_id': models.DirectDebit.get_next_payment_id(),