Skip to content
This repository has been archived by the owner on Jul 9, 2020. It is now read-only.

Commit

Permalink
[admin] Avoid duplicated query generated by ConfigInline
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Sep 8, 2017
1 parent a0fa5ed commit f3bbbbe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions django_netjsonconfig/base/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ class AbstractConfigInline(TimeReadonlyAdminMixin, admin.StackedInline):
'config',
'created',
'modified']
change_select_related = ('device',)

def get_queryset(self, request):
qs = super(AbstractConfigInline, self).get_queryset(request)
return qs.select_related(*self.change_select_related)


class AbstractDeviceAdmin(BaseConfigAdmin):
Expand Down

0 comments on commit f3bbbbe

Please sign in to comment.