>
> And so I am still very strongly against trying to push a 
> model-layer-validation approach in Django, even optionally.
>

It already exists, though. `full_clean()` is a method on Model. CharFields 
on the model *already* have a notion of allowed choices. Validators are 
*already* an option on model fields. *Models already do their own 
validation.* But they require additional implementations of classes further 
up the stack to actually be triggered.

While validation not being a concern of the model layer is a valid design 
choice (not one that I would prefer, but one that I could live with) the 
root of the problem here is that the concept of validation is spread across 
*multiple* layers in a way that's extremely misleading for people coming to 
Django from other ORMs. If I can specify `validators` on a field 
definition, I should be able to expect that it's actually run without extra 
steps.

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.

-- 
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/f136472a-326a-41c2-8ccd-a8024f79b6f4n%40googlegroups.com.
      • ... James Bennett
        • ... Aaron Smith
          • ... Carlton Gibson
          • ... אורי
          • ... Aaron Smith
          • ... Mariusz Felisiak
          • ... Aaron Smith
          • ... James Bennett
          • ... Aaron Smith
          • ... James Bennett
          • ... Aaron Smith
          • ... James Bennett
          • ... Jure Erznožnik
          • ... Aaron Smith
          • ... Shai Berger
    • ... 'Barry Johnson' via Django developers (Contributions to Django itself)
  • Re... Aaron Smith

Reply via email to