I'd like to chime in with this:
There was a point in time when we ran into this issue and solved it with
our own Model descendant.
IMHO, I'm completely with Aaron on this: all the guts are there, just
not being used. It took me quite a while to wrap my brain around the
idea that validation would be specified in models, but only used in
forms. And then some more looking at why all the support functions are
in models, but not being used. It just didn't compute why I would have
validation when using Django one way, but not when I wanted something a
little different.
While all the arguments against providing this function are valid and
good, they neglect that an implementation satisfying n00bs like me would
really not carry any penalties: it's just an if in the model.save
checking against a global setting. No code creep, no additional tests to
write (but I'm pretty sure some of the existing ones might fail, django
or end-app). It would remove some confusion, but grandmasters like
yourselves could still turn it off and do it the way you believe is "the
correct one".
Also, just to be clear: the above solution (turning this on) yielded
TONS of bugs when we did it for our projects. We vastly improved unit
testing following this implementation, so it was a total win for us.
LP,
Jure
On 9. 10. 22 08:58, James Bennett wrote:
On Sat, Oct 8, 2022 at 8:32 PM Aaron Smith <aa...@aaronsmith.co> wrote:
Surely we can agree that /something/ should happen here? The
status quo is confusing, a footgun and a gotcha. If it's not
Model's concern, then get it out of Model.
I've already said that I wish model-level validation hadn't been added
to Django.
Unfortunately it's something that's been in long enough now that it
would be very difficult to deprecate and remove. But that's not an
argument, to my mind, for expanding it.
--
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/CAL13Cg8ZvG6%3DtCNEEKV-4rQURzZ_GFSuPRypkoOOqGULFC9pZw%40mail.gmail.com
<https://groups.google.com/d/msgid/django-developers/CAL13Cg8ZvG6%3DtCNEEKV-4rQURzZ_GFSuPRypkoOOqGULFC9pZw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
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/5ee186ae-f22e-9a4e-c8e9-c0b353f1762b%40gmail.com.