Answer the question
In order to leave comments, you need to log in
How in django DRF ModelSerializer to check for additional fields that are not in the model?
hello there is a model
class ItemSerializer(serializers.ModelSerializer):
test_field = serializers.CharField(max_length=100, required=True)
class Meta:
model = models.Item
fields = ('id', 'name', 'test_field')
Answer the question
In order to leave comments, you need to log in
I suspect that it does not swear during validation, but at the time of saving.
And there is nothing to save, since there is no such field. So you need to change the save.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question