Ticket #1659: models.diff

File models.diff, 1.2 KB (added by ubernostrum, 9 years ago)

Fix auth models file for m-r (and remove some Ellington cruft)

  • models.py

     
    207207            if not settings.AUTH_PROFILE_MODULE:
    208208                raise SiteProfileNotAvailable
    209209            try:
    210                 app, mod = settings.AUTH_PROFILE_MODULE.split('.')
    211                 module = __import__('ellington.%s.apps.%s' % (app, mod), [], [], [''])
    212                 self._profile_cache = module.get(user_id=self.id)
    213             except ImportError:
    214                 try:
    215                     module = __import__('django.models.%s' % settings.AUTH_PROFILE_MODULE, [], [], [''])
    216                     self._profile_cache = module.get(user__id__exact=self.id)
    217                 except ImportError:
    218                     raise SiteProfileNotAvailable
     210                app_label, model_name = settings.AUTH_PROFILE_MODULE.split('.')
     211                model = models.get_model(app_label, model_name)
     212                self._profile_cache = model._default_manager.get(user__id__exact=self.id)
     213            except ImportError, ImproperlyConfigured:
     214                raise SiteProfileNotAvailable
    219215        return self._profile_cache
    220216
    221217class Message(models.Model):
Back to Top