You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently upgraded from django-social-auth to python-social-auth (version 0.1.12) and a bit of code that had worked before is no longer working. I've got a model that points to UserSocialAuth or one of my own custom models through a generic FK, and it throws an error when I try to access it.
Here is the traceback I get (and please let me know if there's any other information I could provide that would be helpful):
Traceback (most recent call last):
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/views/generic/base.py", line 86, in dispatch
return handler(request, *args, **kwargs)
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 218, in get
return super(BaseUpdateView, self).get(request, *args, **kwargs)
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 154, in get
form = self.get_form(form_class)
File "/var/sites/project_name/project_name/user_settings/views.py", line 102, in get_form
return form_class(self.request.user, **self.get_form_kwargs())
File "/var/sites/project_name/project_name/user_settings/forms.py", line 75, in __init__
if user.fb_account:
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/utils/functional.py", line 205, in inner
return func(self._wrapped, *args)
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/contrib/contenttypes/generic.py", line 124, in __get__
ct = self.get_content_type(id=ct_id, using=instance._state.db)
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/contrib/contenttypes/generic.py", line 60, in get_content_type
return ContentType.objects.db_manager(using).get_for_id(id)
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 107, in get_for_id
self._add_to_cache(self.db, ct)
File "/var/venvs/project_name/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 122, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
The text was updated successfully, but these errors were encountered:
Looks like you've found the issue - I have two user social auth CTs in the DB, and one of them doesn't return a model when its model_class() method is called. That explains why the code works when I leave in the old import. Thanks!
I recently upgraded from django-social-auth to python-social-auth (version 0.1.12) and a bit of code that had worked before is no longer working. I've got a model that points to UserSocialAuth or one of my own custom models through a generic FK, and it throws an error when I try to access it.
Here is the traceback I get (and please let me know if there's any other information I could provide that would be helpful):
The text was updated successfully, but these errors were encountered: