Fewer requests on unpaid view
This commit is contained in:
parent
15d2faf8e1
commit
98f355ed20
1 changed files with 6 additions and 3 deletions
|
@ -670,9 +670,12 @@ class SpectacleListView(ListView):
|
||||||
@buro_required
|
@buro_required
|
||||||
def unpaid(request, tirage_id):
|
def unpaid(request, tirage_id):
|
||||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||||
unpaid = tirage.participant_set \
|
unpaid = (
|
||||||
.annotate(nb_attributions=Count('attribution')) \
|
tirage.participant_set
|
||||||
.filter(paid=False, nb_attributions__gt=0).all()
|
.annotate(nb_attributions=Count('attribution'))
|
||||||
|
.filter(paid=False, nb_attributions__gt=0)
|
||||||
|
.select_related('user')
|
||||||
|
)
|
||||||
return render(request, "bda-unpaid.html", {"unpaid": unpaid})
|
return render(request, "bda-unpaid.html", {"unpaid": unpaid})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue