Raid detail: Prefetch all required objects (e.g. response user's rank and main); 164 -> 31 queries.

This commit is contained in:
Casper V. Kristensen 2020-01-02 17:30:07 +01:00
parent 7820021864
commit 57b3a28008
Signed by: caspervk
GPG key ID: 289CA03790535054

View file

@ -88,7 +88,13 @@ class RaidDetailView(SingleObjectMixin, MultiModelFormView):
def get_queryset(self):
return Raid.objects.prefetch_related(
"responses", "responses__character", "comments", "comments__user__main"
"responses",
"responses__character",
"responses__character__user",
"responses__character__user__rank",
"responses__character__user__main",
"comments",
"comments__user__main"
).all()
def get_form_classes(self):