Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'str' object has no attribute '_meta' in Django's admin.py #45

Closed
MarkusH opened this issue Oct 4, 2013 · 0 comments
Closed

Comments

@MarkusH
Copy link
Contributor

MarkusH commented Oct 4, 2013

Traceback (most recent call last):
  File "/home/markus/.venvs/bakery/lib/python3.3/site-packages/django/core/urlresolvers.py", line 340, in urlconf_module
    return self._urlconf_module
AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/markus/.venvs/bakery/lib/python3.3/site-packages/gunicorn/workers/sync.py", line 131, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/markus/.venvs/bakery/lib/python3.3/site-packages/django/core/handlers/wsgi.py", line 255, in __call__
    response = self.get_response(request)
  File "/home/markus/.venvs/bakery/lib/python3.3/site-packages/django/core/handlers/base.py", line 178, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/home/markus/.venvs/bakery/lib/python3.3/site-packages/django/core/handlers/base.py", line 220, in handle_uncaught_exception
    if resolver.urlconf_module is None:
  File "/home/markus/.venvs/bakery/lib/python3.3/site-packages/django/core/urlresolvers.py", line 342, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/home/markus/.venvs/bakery/lib/python3.3/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/markus/Coding/bakery/bakery/urls.py", line 7, in <module>
    admin.autodiscover()
  File "/home/markus/.venvs/bakery/lib/python3.3/site-packages/django/contrib/admin/__init__.py", line 29, in autodiscover
    import_module('%s.admin' % app)
  File "/home/markus/.venvs/bakery/lib/python3.3/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/markus/Coding/python-social-auth/social/apps/django_app/default/admin.py", line 13, in <module>
    all_names = _User._meta.get_all_field_names()
AttributeError: 'str' object has no attribute '_meta'

Pull request follows.

MarkusH added a commit to muffins-on-dope/python-social-auth that referenced this issue Oct 4, 2013
Under some conditions ``UserSocialAuth._meta.get_field('user').rel.to``
does not return a Model class but a string of the form
``'<app_label>.<model_name>'``. This results in an AttributeError in the
Django admin.py which ultimately triggers an error in Django's
RegexURLResolver. This is fixed by properly resolving the user model and
return a class rather than a string.
@omab omab closed this as completed in d8637ce Oct 4, 2013
omab added a commit that referenced this issue Oct 4, 2013
Fixes #45 -- AttributeError while resolving the user model in Django
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant