X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/165161a173154072eb7b999386a13562e110bd0a..031b8be3bf03baa724dd7e225b0555726d089341:/src/pz/admin.py diff --git a/src/pz/admin.py b/src/pz/admin.py index 23ad9c249..ad66a9523 100644 --- a/src/pz/admin.py +++ b/src/pz/admin.py @@ -18,6 +18,8 @@ admin.site.register(models.Campaign) # Backport from Django 3.1. class EmptyFieldListFilter(FieldListFilter): + with_empty_str = False + def __init__(self, field, request, params, model, model_admin, field_path): self.lookup_kwarg = '%s__isempty' % field_path self.lookup_val = params.get(self.lookup_kwarg) @@ -30,6 +32,8 @@ class EmptyFieldListFilter(FieldListFilter): raise IncorrectLookupParameters lookup_condition = Q(**{'%s__isnull' % self.field_path: True}) + if self.with_empty_str: + lookup_condition |= Q(**{self.field_path: ''}) if self.lookup_val == '1': return queryset.filter(lookup_condition) return queryset.exclude(lookup_condition) @@ -77,6 +81,8 @@ class BankPaymentInline(admin.TabularInline): @admin.register(models.DirectDebit) class DirectDebitAdmin(admin.ModelAdmin): + #unpaginate + list_display = [ 'payment_id', 'acquisition_date', 'iban_valid',