#20522: Admin formset validation cannot take submitted model instance into account when form not valid. -------------------------------------+------------------------------------- Reporter: meshy | Owner: kamni Type: Bug | Status: assigned Component: contrib.admin | Version: master Severity: Normal | Resolution: Keywords: admin formset | Triage Stage: Accepted validation | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 1 Needs tests: 0 | UI/UX: 0 Easy pickings: 1 | -------------------------------------+-------------------------------------
Comment (by timo): I sympathize with that concern and am ok adding the additional models. I left a couple more comments on the PR. In wondering why the code wasn't written like this in the first place, I recalled a warning in [https://docs.djangoproject.com/en/1.6/topics/forms/modelforms /#validation-on-a-modelform Validation on a ModelForm]. "The cleaning process modifies the model instance passed to the ModelForm constructor in various ways. For instance, any date fields on the model are converted into actual date objects. Failed validation may leave the underlying model instance in an inconsistent state and therefore it’s not recommended to reuse it." As the OP points out, hopefully "this will be better than the nothing we currently get", but I mention it in case a documentation update might be helpful somewhere. It seems like it could actually break existing formset validation code if model attributes are different types when the form is invalid which makes me a little nervous. -- Ticket URL: <https://code.djangoproject.com/ticket/20522#comment:10> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.954093a318b65f80204b22759cab1b86%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.