Skip to content

Commit

Permalink
Merge pull request #1456 from laws-africa/fix-n+1
Browse files Browse the repository at this point in the history
Fix n+1error
  • Loading branch information
nickmwangemi authored Aug 18, 2023
2 parents 0fc6feb + bd72195 commit 75f1432
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion peachjam/models/judgment.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def apply_labels(self):
if self.alternative_names.exists():
if label not in labels:
self.labels.add(label.pk)
# if the judgment no alternative_names, remove the "reported" label
# if the judgment has no alternative_names, remove the "reported" label
elif label in labels:
self.labels.remove(label.pk)

Expand Down
2 changes: 1 addition & 1 deletion peachjam/views/courts.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class CourtYearView(CourtDetailView):


class CourtRegistryDetailView(CourtDetailView):
queryset = Judgment.objects.prefetch_related("judges")
queryset = Judgment.objects.prefetch_related("judges", "labels")
template_name = "peachjam/court_registry_detail.html"

def get_base_queryset(self):
Expand Down

0 comments on commit 75f1432

Please sign in to comment.