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

create_user() is incorrect for Django 1.5 #179

Open
jaddison opened this issue Mar 26, 2013 · 2 comments
Open

create_user() is incorrect for Django 1.5 #179

jaddison opened this issue Mar 26, 2013 · 2 comments

Comments

@jaddison
Copy link
Contributor

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
Copy link
Contributor Author

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.

https://github.com/jaddison/django-socialregistration/commit/7fc1132c2871147fe0bad61259269ee57950aacc

@jaddison
Copy link
Contributor Author

jaddison commented Jun 6, 2013

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant