From 8d1f599577d9044229f16cc3225ffdcd2dc252b9 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Fri, 28 Oct 2016 14:15:37 -0200 Subject: [PATCH] filter sold attributions --- bda/admin.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bda/admin.py b/bda/admin.py index d0483281..668cc6dd 100644 --- a/bda/admin.py +++ b/bda/admin.py @@ -229,11 +229,10 @@ class SpectacleReventeAdmin(admin.ModelAdmin): actions_on_bottom = True def transfer(self, request, queryset): - for revente in queryset.all(): - if revente.soldTo: - attrib = revente.attribution - attrib.participant = revente.soldTo - attrib.save() + for revente in queryset.exclude(soldTo__isnull=True).all(): + attrib = revente.attribution + attrib.participant = revente.soldTo + attrib.save() transfer.short_description = "Transférer les reventes sélectionnées" def reinit(self, request, queryset):