unlockme
unlockme

Reputation: 4235

Serializer Equivalent of clean for django forms in rest framework Serializers

What is the serializer equivalent of the clean method for django forms.

My use case is that I want to do custom model field validation of some fields for a model serializer class. My guess is it could be the run_validators, for the framework. But I am not sure with certainty.

Thanks, Best regards,

Upvotes: 9

Views: 12557

Answers (1)

unlockme
unlockme

Reputation: 4235

Well, just gone through the documentation and the equivalent is validate (for object level validation). For field level validation use. validate_<field_name>'

See link for more details

Upvotes: 19

Related Questions