B
B
borisovdenis2017-08-02 15:07:24
Django
borisovdenis, 2017-08-02 15:07:24

How to properly validate model fields?

Can you please tell me how to properly validate model fields?
In the REST API, when updating model fields, you need to check these fields for correctness. I read about validaitors, but I don't understand how they work at all. I'm talking about the field parameter, for example

title = models.CharField(max_length=256, validaitors=[some_validation])

I installed these validators, but I don’t understand at what stage they should be called.
Tell me how to do it right through validators or maybe there is a better way.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question