Ticket #10858: auth_user_model_unicode.diff
File auth_user_model_unicode.diff, 1.2 KB (added by , 16 years ago) |
---|
-
django/contrib/auth/models.py
2 2 import urllib 3 3 4 4 from django.contrib import auth 5 from django.conf import settings 5 6 from django.core.exceptions import ImproperlyConfigured 6 7 from django.db import models 7 8 from django.db.models.manager import EmptyManager … … 145 146 verbose_name_plural = _('users') 146 147 147 148 def __unicode__(self): 148 return self.username 149 fmt = getattr(settings, 'AUTH_USER_STR_FORMATTER', None) 150 if fmt is not None: 151 return fmt(self) 152 else: 153 return self.username 149 154 150 155 def get_absolute_url(self): 151 156 return "/users/%s/" % urllib.quote(smart_str(self.username)) … … 276 281 SiteProfileNotAvailable if this site does not allow profiles. 277 282 """ 278 283 if not hasattr(self, '_profile_cache'): 279 from django.conf import settings280 284 if not getattr(settings, 'AUTH_PROFILE_MODULE', False): 281 285 raise SiteProfileNotAvailable 282 286 try: