forked from DGNum/gestioCOF
Use same qset for every field
This commit is contained in:
parent
147b8514ef
commit
f88795a60e
1 changed files with 5 additions and 11 deletions
16
bda/admin.py
16
bda/admin.py
|
@ -282,20 +282,14 @@ class SalleAdmin(admin.ModelAdmin):
|
|||
class SpectacleReventeAdminForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
confirmed_entry_qset = Participant.objects.select_related("user", "tirage")
|
||||
seller_qset = Participant.objects.select_related("user", "tirage")
|
||||
soldTo_qset = Participant.objects.select_related("user", "tirage")
|
||||
qset = Participant.objects.select_related("user", "tirage")
|
||||
|
||||
if self.instance.pk is not None:
|
||||
confirmed_entry_qset = confirmed_entry_qset.filter(
|
||||
tirage=self.instance.seller.tirage
|
||||
)
|
||||
seller_qset = seller_qset.filter(tirage=self.instance.seller.tirage)
|
||||
soldTo_qset = soldTo_qset.filter(tirage=self.instance.seller.tirage)
|
||||
qset = qset.filter(tirage=self.instance.seller.tirage)
|
||||
|
||||
self.fields["confirmed_entry"].queryset = confirmed_entry_qset
|
||||
self.fields["seller"].queryset = seller_qset
|
||||
self.fields["soldTo"].queryset = soldTo_qset
|
||||
self.fields["confirmed_entry"].queryset = qset
|
||||
self.fields["seller"].queryset = qset
|
||||
self.fields["soldTo"].queryset = qset
|
||||
|
||||
|
||||
class SpectacleReventeAdmin(admin.ModelAdmin):
|
||||
|
|
Loading…
Reference in a new issue