Skip to content

Commit

Permalink
fixes n+1 in judgment admin
Browse files Browse the repository at this point in the history
  • Loading branch information
actlikewill committed Oct 16, 2023
1 parent 1c87a87 commit 5723a59
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions peachjam/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,11 @@ def get_fieldsets(self, request, obj=None):

return fieldsets

def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "registry":
kwargs["queryset"] = CourtRegistry.objects.select_related("court")
return super().formfield_for_foreignkey(db_field, request, **kwargs)


@admin.register(Predicate)
class PredicateAdmin(admin.ModelAdmin):
Expand Down

0 comments on commit 5723a59

Please sign in to comment.