|
@@ -41,10 +41,10 @@ class PaymentStatusFilter(admin.SimpleListFilter):
|
|
|
)
|
|
|
|
|
|
def queryset(self, request, queryset):
|
|
|
- # FIXME ne marche pas, les STOP sont inclus
|
|
|
- actives = PaymentUpdate.objects.filter(validated=True).order_by('payment', '-start') \
|
|
|
- .distinct('payment').exclude(payment_method=PaymentUpdate.STOP) \
|
|
|
- .values_list('payment__pk', flat=True)
|
|
|
+ payments = PaymentUpdate.objects.filter(validated=True).order_by('payment', '-start')\
|
|
|
+ .distinct('payment').values('payment_method', 'payment__pk')
|
|
|
+ actives = filter(lambda p: p['payment_method'] != PaymentUpdate.STOP, payments)
|
|
|
+ actives = map(lambda p: p['payment__pk'], actives)
|
|
|
if self.value() == '0':
|
|
|
return queryset.exclude(pk__in=actives)
|
|
|
if self.value() == '1':
|