Commits

Apostolis Bessas committed 07490ca

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

  • Participants
  • Parent commits a2d6f08

Comments (0)

Files changed (1)

transifex/txcommon/views.py

 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,
     fulltext_project_search_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()