Skip to content

Commit

Permalink
Prefetching users to avoid N+1 queries
Browse files Browse the repository at this point in the history
  • Loading branch information
abithyzis authored and Bouke committed Jun 21, 2020
1 parent 8ab6a4d commit 0c5337b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions user_sessions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class SessionAdmin(admin.ModelAdmin):
list_filter = ExpiredFilter, OwnerFilter
raw_id_fields = 'user',
exclude = 'session_key',
list_select_related = ['user']

def get_search_fields(self, request):
User = get_user_model()
Expand Down

0 comments on commit 0c5337b

Please sign in to comment.