Apostolis Bessas avatar Apostolis Bessas committed 07490ca

minor: fetch profile and user in one query instead of two.

Comments (0)

Files changed (1)


 from transifex.simpleauth.forms import RememberMeAuthForm
 from transifex.txcommon.filters import LogEntryFilter
 from transifex.txcommon.log import logger
-from transifex.txcommon.haystack.utils import (support_fulltext_search, 
-    prepare_solr_query_string, fulltext_fuzzy_match_filter, 
+from transifex.txcommon.haystack.utils import (support_fulltext_search,
+    prepare_solr_query_string, fulltext_fuzzy_match_filter,
 from transifex.txcommon.feeds import TxNoticeUserFeed
 def profile_public(request, username, template_name='userena/public.html'):
     """User public profile page."""
-    user = get_object_or_404(User, username=username)
+    user = get_object_or_404(
+        User.objects.select_related('profile'), username=username
+    )
     teams_coordinating = user.team_coordinators.public()
     projects_maintaining = Project.objects.maintained_by(user).public()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.