On Thu, 29 Sep 2022, at 14:29, Aaron Smith wrote:
> Why doesn't Django validate Models on save()?

The short answer is: backwards compatibility.

Model level validation hasn't always been a thing, with Django initially 
depending primarily on Form validation.

Since it hadn't _always_ been there, it wasn't possible to introduce it, 
enforce it, and not break most apps out there.

There was so much code written that generally assumed it could call `save()` 
and not have to catch validation errors.

For what it's worth, I'm all in favor of making it run on `save()` ... updating 
the documentation and preparing the community is going to be a mammoth task, 
however. A safe course through this will take some very careful planning.

--
C

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/10d789b9-5f10-4823-98e8-0494c8510bf7%40app.fastmail.com.

Reply via email to