+class PayedListFilter(SimpleListFilter):
+ title = 'pobrane'
+ parameter_name = 'payed'
+ def lookups(self, request, model_admin):
+ return (
+ ('yes', 'tak'),
+ ('no', 'nie'),
+ )
+
+ def queryset(self, request, queryset):
+ if self.value() == 'yes':
+ return queryset.filter(payment__is_dd=True, payment__realised=True).distinct()
+ if self.value() == 'no':
+ return queryset.exclude(payment__is_dd=True, payment__realised=True).distinct()
+
+
+