Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #2189 -- Optimized auth.User.get_all_permissions() to use selec…

…t_related behind the scenes to avoid multiple queries. Thanks, konrad@gwu.edu

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3162 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 551a0272e62133606d34952c309290c3e48c8a61 1 parent 496d651
@adrianholovaty adrianholovaty authored
Showing with 2 additions and 1 deletion.
  1. +1 −0  AUTHORS
  2. +1 −1  django/contrib/auth/models.py
View
1  AUTHORS
@@ -74,6 +74,7 @@ answer newbie questions, and generally made Django that much better:
Cameron Knight (ckknight)
Bruce Kroeze <http://coderseye.com/>
Joseph Kocherhans
+ konrad@gwu.edu
lakin.wecker@gmail.com
Stuart Langridge <http://www.kryogenix.org/>
Eugene Lazutkin <http://lazutkin.com/blog/>
View
2  django/contrib/auth/models.py
@@ -160,7 +160,7 @@ def get_group_permissions(self):
def get_all_permissions(self):
if not hasattr(self, '_perm_cache'):
import sets
- self._perm_cache = sets.Set(["%s.%s" % (p.content_type.app_label, p.codename) for p in self.user_permissions.all()])
+ self._perm_cache = sets.Set(["%s.%s" % (p.content_type.app_label, p.codename) for p in self.user_permissions.select_related()])
self._perm_cache.update(self.get_group_permissions())
return self._perm_cache
Please sign in to comment.
Something went wrong with that request. Please try again.