M2M model field without blank=True
should map to a serializer relationship with allow_empty=False
. · Issue #2804 · encode/django-rest-framework (original) (raw)
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.