Problems with Django 1.8

1,503 views
Skip to first unread message

Martin Peveri

unread,
Apr 2, 2015, 4:35:31 PM4/2/15
to python-so...@googlegroups.com
My friends,

Upgrade my application to Django 1.8 and  I hava problem with login, for example:

1) Login with twitter, I clean the email field.  The solution I found is in the pipeline commented 'user_detail':

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.get_username',
    'apps.users.pipelines.require_email',
    'apps.users.pipelines.custom_mail_validation',
    'social.pipeline.social_auth.associate_by_email',  
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    #'social.pipeline.user.user_details',
    'apps.users.pipelines.login'
)

If this is good, not know, but it worked. Comments are welcome :) 

2) This error is serious. When login with twitter first time, i have problem with create_user. Display this error:

"null value in column "last_login" violates not-null constraint
DETAIL:  Failing row contains"

With django 1.7 this worked ok.

Thaks!

Matías Aguirre

unread,
Apr 2, 2015, 5:49:00 PM4/2/15
to Martin Peveri, python-social-auth
Hi Martin,

That's an odd error, the field definition says that's OK to be null (in the
model and in the migration). Did you ran the db migrations? Maybe you have
a custom user model?

Matías

Excerpts from Martin Peveri's message of 2015-04-02 17:35:31 -0300:
--
Matías Aguirre (matias...@gmail.com)

Martin Peveri

unread,
Apr 2, 2015, 6:39:02 PM4/2/15
to python-so...@googlegroups.com, martin...@gmail.com
Yes, I have a custom user model. This is:

class MyUser(AbstractBaseUser, PermissionsMixin):

        username = models.CharField(max_length=50, unique=True)
       email = models.EmailField(max_length=50, unique=True, db_index=True)
       surname = models.CharField(max_length=100)
      name = models.CharField(max_length=100)

        objects = MyUserManager()

        is_active = models.BooleanField(default=True)
  is_staff = models.BooleanField(default=False)

I try of add field last_login, but it gave me an error saying that the field was already.



Matías Aguirre

unread,
Apr 2, 2015, 7:05:38 PM4/2/15
to Martin Peveri, python-social-auth
The field in AbstractBaseUser is defined as a null-blank field[1]. It clearly
says that the column can be null or empty, the initial migration[2] specified
the field as non-null, but that's changed later by another migration[3]. Ensure
that the migrations where properly applied in your project:

$ python manage.py migrate

[1]: https://github.com/django/django/blob/1.8/django/contrib/auth/models.py#L197
[2]: https://github.com/django/django/blob/1.8/django/contrib/auth/migrations/0001_initial.py#L55
[3]: https://github.com/django/django/blob/1.8/django/contrib/auth/migrations/0005_alter_user_last_login_null.py#L14-L18

Matías

Excerpts from Martin Peveri's message of 2015-04-02 19:39:02 -0300:
--
Matías Aguirre (matias...@gmail.com)

Martin Peveri

unread,
Apr 2, 2015, 7:25:56 PM4/2/15
to python-so...@googlegroups.com, martin...@gmail.com
Great!!. It worked now.

Last query: It's fine if comment this line in the pipeline "social.pipeline.user.user_details"?.

This is because I whitens the email field in the login.

Thanks Matias!


Scott Hostovich

unread,
Apr 20, 2015, 3:29:12 PM4/20/15
to python-so...@googlegroups.com, martin...@gmail.com
Martin: What precisely did you do to get this working? Just run migrations?

Martin Peveri

unread,
Apr 20, 2015, 3:41:05 PM4/20/15
to python-so...@googlegroups.com, martin...@gmail.com
Hi Scott, exactly. Just follow indication of Matias.

Regards
Reply all
Reply to author
Forward
0 new messages