The problems I see with implementing validation on the clean method are:

  1. They will only be called automatically by forms (django.forms and admin) — this is not always the case.
  2. To force validation on every save, you either have to be very discipline or override save. Overriding save can work but It means interfering with Django inner works (you have to ask your self, why didn’t Django just add clean to save ?). Also, external apps that rely on Django save might not work as expected (ValidationError is not an expected outcome of obj.save()).

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