Reduce gallery load time by prefetching owners
This commit is contained in:
parent
7598c47621
commit
2200b0d436
1 changed files with 3 additions and 1 deletions
|
|
@ -51,7 +51,9 @@ class CustomGalleryDetailView(DetailView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['photos'] = self.object.public()
|
||||
|
||||
# Query with extended and owner to reduce database lag
|
||||
context['photos'] = self.object.public().select_related('extended__owner')
|
||||
|
||||
# List owners
|
||||
context['owners'] = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue