Hi guys,

I built a site using the built in mezzanine.accounts app, but I've ran into
some limitations with django's default user model and now I have to add a
custom user model.

I have added my custom user app, migrated DB with South and the runserver
works. But when I try to access the site I get an error and  the following
traceback:

[11/Jun/2015 08:05:06] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
line 85, in run
    self.result = application(self.environ, self.start_response)
  File
"/Users/mariogudelj/Envs/sfft/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py",
line 67, in __call__
    return self.application(environ, start_response)
  File
"/Users/mariogudelj/Envs/sfft/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py",
line 67, in __call__
    return self.application(environ, start_response)
  File
"/Users/mariogudelj/Envs/sfft/lib/python2.7/site-packages/django/core/handlers/wsgi.py",
line 187, in __call__
    self.load_middleware()
  File
"/Users/mariogudelj/Envs/sfft/lib/python2.7/site-packages/django/core/handlers/base.py",
line 47, in load_middleware
    mw_instance = mw_class()
  File
"/Users/mariogudelj/Envs/sfft/lib/python2.7/site-packages/django/middleware/locale.py",
line 24, in __init__
    for url_pattern in get_resolver(None).url_patterns:
  File
"/Users/mariogudelj/Envs/sfft/lib/python2.7/site-packages/django/core/urlresolvers.py",
line 365, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
  File
"/Users/mariogudelj/Envs/sfft/lib/python2.7/site-packages/django/core/urlresolvers.py",
line 360, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File
"/Users/mariogudelj/Envs/sfft/lib/python2.7/site-packages/django/utils/importlib.py",
line 40, in import_module
    __import__(name)
  File "/Users/mariogudelj/experiment/sfft/urls.py", line 10, in <module>
    admin.autodiscover()
  File "/Users/mariogudelj/experiment/sfft/mezzanine/boot/__init__.py",
line 78, in autodiscover
    admin_site.lazy_registration()
  File "/Users/mariogudelj/experiment/sfft/mezzanine/boot/lazy_admin.py",
line 49, in lazy_registration
    getattr(AdminSite, name)(self, *deferred_args, **deferred_kwargs)
  File
"/Users/mariogudelj/Envs/sfft/lib/python2.7/site-packages/django/contrib/admin/sites.py",
line 107, in unregister
    raise NotRegistered('The model %s is not registered' % model.__name__)

NotRegistered: The model User is not registered

I also have ADMIN_REMOVAL = ('django.contrib.auth.models.User',) in my
settings file and that's not helping.

My custom user model is set in settings.py:

AUTH_USER_MODEL = 'contacts.Customer'

I've been googling the issue for a few hours now and I can't figure it.

I've looked at LazyAdminSite and Django's AdminSite, but that flew over my
head a bit.

I have removed every instance of admin.site.unregister(User) and even
without ADMIN_REMOVAL the unregister is being called from lazy_registration
function.

If I trace and look at self._deferredinside this for loop

for name, deferred_args, deferred_kwargs in self._deferred:

I see this:

[(u'unregister', (<class 'django.contrib.auth.models.User'>,), {}),
(u'register', (<class 'django.contrib.auth.models.User'>, <class
'longerusernameandemail.admin.LongerUsernameAndEmailUserAdmin'>), {})]

But I'm not sure where those things are coming from. longerusernameandemail
is not inside installed_apps and I can't fine admin.site.unregister(User)
or admin.site.register(User) anywhere.

Any help is greatly appreciated.

Thanks!

M

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to