-
Notifications
You must be signed in to change notification settings - Fork 83
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
UserProfileSerializer doesn't handle foreignKey fields? #106
Labels
Comments
Hi @jonas87 After that, we could work on the MR you provided (so we can be sure that it indeed fixes the issue by having a reproduced example in the test). |
apragacz
added a commit
that referenced
this issue
Apr 4, 2020
This test should be unskipped when issue #106 will be resolved
apragacz
added a commit
that referenced
this issue
Apr 4, 2020
This test should be unskipped when issue #106 will be resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I have a foreignKey on one of the fields of my User model (did this by subclassing AbstractUser and pointing AUTH_USER_MODEL in settings.py to this User model). These extra fields are showing up correctly in my calls to "accounts/register/". However when I'm submitting my registration form I'm submitting an integer that represents the primary key for this foreignKey field and I get the following error:
Cannot assign "4": "User.user_type" must be a "UserType" instance.
The error happens in _build_initial_user() on line 175 of rest_registration/api/serializers.py because it's trying to construct an instance of the usermodel there with self.initial_data which holds an integer for the ForeignKey field.
The text was updated successfully, but these errors were encountered: