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.

Written by

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store