Haki Benita
1 min readJan 6, 2019

--

I might be mistaken but I don’t think that validators defined on model fields are executed on save, Only during clean, in which case if you save a model directly (not via a Django form) it will not be validated. Haven’t checked though. Please let me know if I’m wrong.

I’m not against using validators and the built-in clean. I use it all the time. I mostly use it for simple tables managed by support personnel manage directly in the admin. Things like product details, categories, shipment types etc. These objects are usually very simple, they don’t require complicated logic and there is no business logic involved in updating them . I only use the approach suggested in this article for complicated models.

--

--

Haki Benita
Haki Benita

Written by Haki Benita

Full Stack Developer, Team Leader, Independent. More from me at https://hakibenita.com

No responses yet