Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

create_user() is incorrect for Django 1.5 #179

Open
jaddison opened this Issue · 2 comments

1 participant

@jaddison

On line https://github.com/flashingpumpkin/django-socialregistration/blob/master/socialregistration/mixins.py#L126 it reads:

return User()

but technically it should read:

return get_user_model()()

which, while ugly, works for Django 1.5 (edit: when using a custom user model). Otherwise, I get a stack trace like the following:

Environment:


Request Method: GET
Request URL: http://local.chatterblock.com:8000/social/facebook/setup/

Django Version: 1.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'django.contrib.sitemaps',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.contrib.redirects',
 'django.contrib.comments',
 'threadedcomments',
 'socialregistration',
 'socialregistration.contrib.facebook',
 'django_extensions',
 'south',
 'haystack',
 'pagination',
 'taggit',
 'sorl.thumbnail',
 'djcelery',
 'celery_haystack',
 'spurl',
 'activities',
 'cpanel',
 'profiles')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'socialregistration.contrib.facebook.middleware.FacebookMiddleware',
 'profiles.middleware.UserProfileMiddleware',
 'django.contrib.redirects.middleware.RedirectFallbackMiddleware')


Traceback:
File "/Users/jaddison/.virtualenvs/chatterblock/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/jaddison/.virtualenvs/chatterblock/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)
File "/Users/jaddison/.virtualenvs/chatterblock/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  86.         return handler(request, *args, **kwargs)
File "/Users/jaddison/.virtualenvs/chatterblock/lib/python2.7/site-packages/socialregistration/views.py" in get
  329.             profile = self.create_profile(user, **lookup_kwargs)
File "/Users/jaddison/.virtualenvs/chatterblock/lib/python2.7/site-packages/socialregistration/mixins.py" in create_profile
  137.         profile = self.get_model()(user=user, **kwargs)
File "/Users/jaddison/.virtualenvs/chatterblock/lib/python2.7/site-packages/django/db/models/base.py" in __init__
  403.                 setattr(self, field.name, rel_obj)
File "/Users/jaddison/.virtualenvs/chatterblock/lib/python2.7/site-packages/django/db/models/fields/related.py" in __set__
  405.                                  self.field.name, self.field.rel.to._meta.object_name))

Exception Type: ValueError at /social/facebook/setup/
Exception Value: Cannot assign "<User: >": "FacebookProfile.user" must be a "User" instance.
@jaddison

This quick fix commit in my fork addressed the problem - but I doubt it's the best solution for maintaining backward compatibility if that is a concern.

jaddison@7fc1132

@jaddison

Just curious if Django 1.5 compatibility progress is moving forward or not with this app? It seems to have stalled somewhat?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.