Skip to content

Commit

Permalink
admin: Attempt to optimize matches admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiq0 committed Jan 11, 2025
1 parent 9517c2f commit 7c374cd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions web/proboj/matches/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
class MatchBotInline(admin.TabularInline):
model = MatchBot

def get_formset(self, request, obj=None, **kwargs):
formset = super(MatchBotInline, self).get_formset(request, obj, **kwargs)

queryset = formset.form.base_fields["bot_version"].queryset
queryset = queryset.select_related("bot")
formset.form.base_fields["bot_version"].queryset = queryset

return formset


@admin.action(description="Enqueue selected matches")
def enqueue_match(modeladmin, request, queryset):
Expand Down

0 comments on commit 7c374cd

Please sign in to comment.