Hello, I am trying to understand why field validators (model.full_clean()) are not called for model.save()
I've spent about an hour reviewing all the discussions/replies on this subject; http://www.xormedia.com/django-model-validation-on-save/ http://stackoverflow.com/questions/4441539/why-doesnt-djangos-model-save-call-full-clean https://code.djangoproject.com/ticket/13100 https://groups.google.com/forum/#!topic/django-developers/uIhzSwWHj4c >From what I can tell this was rejected on the basis of breaking backwards compatibility. It is unclear whether this would have been desired behavior had backwards compatibility not been an issue. It also seems to me that it would be possible to maintain backwards compatibility by using settings flags to determine the default behavior, albeit at the cost of increased complexity. So I have four questions; 1) Without taking backwards compatibility into consideration, is it reasonable to expect field validation automatically upon calling model.save() 2) At what point would Django devs be willing to break backwards compatibility? Would this be considered on 2.x, or is it life time? 3) Could backwards compatibility not be maintained by means of a flag in settings? For example, settings.MODEL_VALIDATE_ON_SAVE=True would cause the validation to be handled using the new approach? 4) Assuming this cannot/will not be implemented, what would be the most suitable workaround? Are there any risks in calling full_clean() without ever using ModelForm? Should ModelForm always be used instead of using a model directly? etc. Any comments/feedback would be much appreciated, I am also happy to spend time updating docs to reflect responses in this thread. Thanks Cal -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAHKQagHu%2BLV%3DLNq%3DYaKc2PsF20qWniMkPhAiP9ZrOVVrMmVGkg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
