Fewer requests on spectacles and participants list views
This commit is contained in:
parent
93a3a9af2c
commit
15d2faf8e1
1 changed files with 8 additions and 2 deletions
10
bda/views.py
10
bda/views.py
|
@ -622,7 +622,10 @@ def revente_shotgun(request, tirage_id):
|
|||
def spectacle(request, tirage_id, spectacle_id):
|
||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||
spectacle = get_object_or_404(Spectacle, id=spectacle_id, tirage=tirage)
|
||||
attributions = spectacle.attribues.all()
|
||||
attributions = (
|
||||
spectacle.attribues
|
||||
.select_related('participant', 'participant__user')
|
||||
)
|
||||
participants = {}
|
||||
for attrib in attributions:
|
||||
participant = attrib.participant
|
||||
|
@ -651,7 +654,10 @@ class SpectacleListView(ListView):
|
|||
|
||||
def get_queryset(self):
|
||||
self.tirage = get_object_or_404(Tirage, id=self.kwargs['tirage_id'])
|
||||
categories = self.tirage.spectacle_set.all()
|
||||
categories = (
|
||||
self.tirage.spectacle_set
|
||||
.select_related('location')
|
||||
)
|
||||
return categories
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
|
Loading…
Reference in a new issue