X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/357027375ff8867f42ca34bcbfb5a78b5b185fc3..16ea958a176bc60e669944edd5d1eb393d6aa90c:/src/funding/admin.py?ds=inline diff --git a/src/funding/admin.py b/src/funding/admin.py index d70aef66a..5f552c45d 100644 --- a/src/funding/admin.py +++ b/src/funding/admin.py @@ -21,29 +21,33 @@ class PerkAdmin(admin.ModelAdmin): list_filter = ['offer'] - class PayedFilter(admin.SimpleListFilter): title = _('payment complete') parameter_name = 'payed' + def lookups(self, request, model_admin): return ( ('yes', _('Yes')), ('no', _('No')), ) + def queryset(self, request, queryset): if self.value() == 'yes': return queryset.exclude(payed_at=None) elif self.value() == 'no': return queryset.filter(payed_at=None) + class PerksFilter(admin.SimpleListFilter): title = _('perks') parameter_name = 'perks' + def lookups(self, request, model_admin): return ( ('yes', _('Yes')), ('no', _('No')), ) + def queryset(self, request, queryset): if self.value() == 'yes': return queryset.exclude(perks=None) @@ -58,7 +62,6 @@ class FundingAdmin(admin.ModelAdmin): list_filter = [PayedFilter, 'offer', PerksFilter] - class SpentAdmin(admin.ModelAdmin): model = Spent list_display = ['book', 'amount', 'timestamp']