X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/165161a173154072eb7b999386a13562e110bd0a..ca8f4e8fef80cb603117ed579da8554f503698e5:/src/pz/admin.py diff --git a/src/pz/admin.py b/src/pz/admin.py index 23ad9c249..1bbb1da6d 100644 --- a/src/pz/admin.py +++ b/src/pz/admin.py @@ -5,7 +5,6 @@ from django.db.models import Q from django.shortcuts import get_object_or_404, redirect from django.urls import path, reverse from django.utils.safestring import mark_safe -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 @@ -18,6 +17,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 +31,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) @@ -39,9 +42,9 @@ class EmptyFieldListFilter(FieldListFilter): def choices(self, changelist): for lookup, title in ( - (None, _('All')), - ('1', _('Empty')), - ('0', _('Not empty')), + (None, 'Wszystkie'), + ('1', 'Puste'), + ('0', 'Niepuste'), ): yield { 'selected': self.lookup_val == lookup, @@ -77,6 +80,8 @@ class BankPaymentInline(admin.TabularInline): @admin.register(models.DirectDebit) class DirectDebitAdmin(admin.ModelAdmin): + #unpaginate + list_display = [ 'payment_id', 'acquisition_date', 'iban_valid', @@ -112,6 +117,7 @@ class DirectDebitAdmin(admin.ModelAdmin): fieldsets = [ (None, { "fields": [ + 'nosignature', ('first_name', 'sex', 'date_of_birth'), 'last_name', ('street', 'building'), @@ -129,7 +135,7 @@ class DirectDebitAdmin(admin.ModelAdmin): 'campaign', ] }), - (_('Processing'), {"fields": [ + ('Przetwarzanie', {"fields": [ ('cancelled_at', 'needs_redo', 'optout'), 'submission_date', 'fundraiser_commission', @@ -165,8 +171,8 @@ class DirectDebitAdmin(admin.ModelAdmin): ] def agree_contact(self, obj): - return _('obligatory') - agree_contact.short_description = _('agree contact') + return 'obowiązkowo' + agree_contact.short_description = 'zgoda na kontakt' def get_changeform_initial_data(self, request): return {