Skip to content

Clearing a ManyToManyField in a multipart PATCH Request #2883

@DavidMuller

Description

@DavidMuller

Hello,

I'm having some trouble clearing a ManyToMany field in a multipart PATCH request.

In a JSON request, I would clear my ManyToMany field, 'many_to_many_field' by PATCHing something like:

{"many_to_many_field": []}

However, in a multipart PATCH request, sending values including '[]', '', 'null', 'None', etc all yield the following error:

["Incorrect type. Expected pk value, received unicode."]

It seems that ManyRelatedField.get_value() does not recognize any of those options as special indicators of empty.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy