Skip to content

Commit

Permalink
Fix n+1 query on exhibit routes
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodiegoss committed Oct 27, 2024
1 parent 6fe3c67 commit b6ebb4c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,8 @@ def artwork_preview(request):
@require_http_methods(["GET"])
def exhibit(request, slug):
exhibit = get_object_or_404(Exhibit.objects.prefetch_related("artworks"), slug=slug)
ctx = {"exhibit": exhibit, "artworks": exhibit.artworks.all()}
ctx = {
"exhibit": exhibit,
"artworks": exhibit.artworks.select_related("marker", "augmented").all(),
}
return render(request, "core/exhibit.jinja2", ctx)

0 comments on commit b6ebb4c

Please sign in to comment.