Skip to content

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

Description

@mahdiashtian

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions