Browse Source

Preload Profile.current_project, saves one query per request.

pull/214/head
Pēteris Caune 6 years ago
parent
commit
d403260e9b
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      hc/accounts/backends.py

+ 4
- 1
hc/accounts/backends.py View File

@ -6,7 +6,10 @@ class BasicBackend(object):
def get_user(self, user_id):
try:
return User.objects.select_related("profile").get(pk=user_id)
q = User.objects.select_related("profile",
"profile__current_project")
return q.get(pk=user_id)
except User.DoesNotExist:
return None


Loading…
Cancel
Save