X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/dd97d72ae70af77315e97e26e8e60a0d202789e8..7ad1e269182ce7d30dc5aa96b9b0f2c9427dac95:/src/pz/admin.py?ds=inline diff --git a/src/pz/admin.py b/src/pz/admin.py index 86779316c..0be845b19 100644 --- a/src/pz/admin.py +++ b/src/pz/admin.py @@ -1,5 +1,8 @@ from django.contrib import admin from django.utils.translation import gettext_lazy as _ +from django.utils.timezone import now +from fnpdjango.actions import export_as_csv_action +from . import bank from . import models @@ -8,7 +11,33 @@ admin.site.register(models.Campaign) @admin.register(models.DirectDebit) class DirectDebitAdmin(admin.ModelAdmin): - list_display = ['acquisition_date', 'amount', 'first_name', 'last_name'] + list_display = [ + 'payment_id', 'acquisition_date', + 'iban_valid', + 'bank_submission_date', + 'bank_acceptance_date', + 'amount', 'first_name', 'last_name', + ] + date_hierarchy = 'acquisition_date' + search_fields = [ + 'payment_id', 'first_name', 'last_name', 'street', 'building', 'town', 'flat', + 'phone', 'email', 'iban', + 'notes', + 'fundraiser_bill', + ] + list_filter = [ + 'iban_valid', + 'agree_fundraising', + 'agree_newsletter', + 'fundraiser', + 'campaign', + 'is_cancelled', + 'needs_redo', + 'optout', + 'amount', + 'sex', + 'is_consumer', + ] fieldsets = [ (None, { "fields": [ @@ -18,7 +47,7 @@ class DirectDebitAdmin(admin.ModelAdmin): ('town', 'flat'), ('postal_code', 'phone'), 'email', - 'iban', + ('iban', 'iban_valid', 'iban_warning'), 'payment_id', 'agree_contact', 'agree_fundraising', @@ -40,7 +69,15 @@ class DirectDebitAdmin(admin.ModelAdmin): ] }) ] - readonly_fields = ['agree_contact'] + readonly_fields = ['agree_contact', 'iban_valid', 'iban_warning'] + + def set_bank_submission(m,r,q): + q.update(bank_submission_date=now()) + actions = [ + bank.bank_export, + set_bank_submission, + export_as_csv_action(), + ] def agree_contact(self, obj): return _('obligatory')