508👍
✅
If you want to be able to specify ManyToMany relation without making it required just use blank=True
:
class Group(models.Model):
...
events = models.ManyToManyField(Event, blank=True)
3👍
If Ludwik’s answer does not solve the issue, set required to false in the serializer as well:
class RecipeDetailSerializer(RecipeSerializer):
"""Recipe detail serializer"""
tags = TagSerializer(many=True, required=False)
- [Django]-Why am I getting this error in Django?
- [Django]-How can I create a deep clone of a DB object in Django?
- [Django]-Querying django migrations table
Source:stackexchange.com