Ticket #4196: user_get_profile.diff

File user_get_profile.diff, 745 bytes (added by Matt Riggott, 8 years ago)
  • django/contrib/auth/models.py

     
    257257            try:
    258258                app_label, model_name = settings.AUTH_PROFILE_MODULE.split('.')
    259259                model = models.get_model(app_label, model_name)
    260                 self._profile_cache = model._default_manager.get(user__id__exact=self.id)
     260                self._profile_cache = model._default_manager.select_related(depth=1).get(user__id__exact=self.id)
    261261            except (ImportError, ImproperlyConfigured):
    262262                raise SiteProfileNotAvailable
    263263        return self._profile_cache
Back to Top