Compare commits

..

No commits in common. "ae56229afedd191369b0012fd373714c2060f357" and "7820021864fe39c20f6deba708e91f7f21a4b04a" have entirely different histories.

View file

@ -4,7 +4,7 @@ from datetime import timedelta
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import PermissionRequiredMixin from django.contrib.auth.mixins import PermissionRequiredMixin
from django.db.models import Q, Max, prefetch_related_objects from django.db.models import Q, Max
from django.http import Http404 from django.http import Http404
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils import timezone from django.utils import timezone
@ -88,13 +88,7 @@ class RaidDetailView(SingleObjectMixin, MultiModelFormView):
def get_queryset(self): def get_queryset(self):
return Raid.objects.prefetch_related( return Raid.objects.prefetch_related(
"responses", "responses", "responses__character", "comments", "comments__user__main"
"responses__character",
"responses__character__user",
"responses__character__user__rank",
"responses__character__user__main",
"comments",
"comments__user__main"
).all() ).all()
def get_form_classes(self): def get_form_classes(self):
@ -144,7 +138,6 @@ class RaidDetailView(SingleObjectMixin, MultiModelFormView):
.order_by("main__klass") .order_by("main__klass")
pseudo_no_responses = [RaidResponse(character=user.main, status=None) pseudo_no_responses = [RaidResponse(character=user.main, status=None)
for user in no_response_users] for user in no_response_users]
prefetch_related_objects(pseudo_no_responses, "character__user__rank", "character__user__main")
context["responses"] = list(raid.responses.all()) + pseudo_no_responses context["responses"] = list(raid.responses.all()) + pseudo_no_responses
return context return context