Skip to content

M2M model field without blank=True should map to a serializer relationship with allow_empty=False. #2804

Closed
@marccerrato

Description

@marccerrato

The Django 1.8 system check framework displays the warning fields.W340 when the null parameter is defined on a ManyToManyField, since it has no effect.

This null field affects on whether a related field in a model serializer is considered required or not. We can see it here.

From my point of view, this behavior is correct for a ForeignKey but not for a ManyToManyField, that should be considered not required by default.

Adding the var to_many to the condition on the aforementioned code might do the trick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions