omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

FieldError in django_orm #1010

Closed chripede closed 7 years ago

chripede commented 8 years ago

I'm using partial pipelines to append fields to details. Those fields are used in my create_user for other things than storing them on the user object.

However because of this commit: https://github.com/omab/python-social-auth/commit/9f86059e9d8070bc5ecd7ba069fadab1c9bf502a

IntegrityErrors (user email already exists) the exception handling will now try to look up the user using all the fields from args and kwargs. This includes all fields from details. This will result in a FieldError from Django because not all fields from details are found on the user model

omab commented 7 years ago

Your problem looks more like that the create_user(*args, **kwargs) call is passing all the parameters you sent to it, that will cause you trouble with Django ORM, that's why the default pipeline limits the data passed to just the needed fields. You shouldn't be passing attributes that aren't part of the model to that method.