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

Setting null when sending data as form data in one-to-one relationships #173

Open
mahdiashtian opened this issue Oct 20, 2022 · 0 comments

Comments

@mahdiashtian
Copy link

my code:

 class UserSerializer(NestedUpdateMixin, serializers.ModelSerializer):
  skill = SkillSerializer(many=True, required=False)
  experience = ExperienceSerializer(many=True, required=False)
  education = EducationSerializer(many=True, required=False)
  profile = ProfileSerializer(required=True, instance=Profile)

 class ProfileSerializer(WritableNestedModelSerializer):
  child = ChildSerializer(many=True, required=False)
  foreigner = UserForeignerSerializer(required=False, allow_null=True, instance=UserForeigner)

When I send the data as a form-data, one-to-one relationships are lost and set to null
But when I make a request in the form of json, it is applied correctly, the request must be sent in the form of a form-data
Does anyone know what the problem is?

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