M
M
MiAbo2021-06-29 16:13:10
Django
MiAbo, 2021-06-29 16:13:10

Validation at the object level?

Django lacks the ability to validate values ​​set at the object level. Only in forms.
How often do you need validation to happen at the feature level as well? That is, when creating/updating objects in code, and are there projects that work very much with objects outside of forms? Will there be a demand for a solution that provides such an opportunity?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2021-06-29
@MiAbo

In the Django REST Framework, validation is done at the serializer level.
When saving django forms - in the clean method
But nothing prevents the same clean method from being used for custom validation. Well, or override save if necessary.
So at the level of objects - the need is not frequent.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question