#20023: Admin Inline form validation must go in Model.clean()
-------------------------------------+-------------------------------------
Reporter: chris.freeman.pdx@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.5
Severity: Normal | Resolution:
Keywords: admin inline form | Triage Stage:
validation | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by chris.freeman.pdx@…):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
I had a similar question open on StackOverflow
(http://stackoverflow.com/questions/15330490/django-clean-field-is-not-
being-called-for-updates-on-admin-inline-form). It was answered by
pointing to
(https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.form),
which implies the answer: Since no form is specified, a model will be
used. However, if I specify the form, but ''not'' the model, I get a
{{{'model' is required attribute of 'ModelAdmin.inlines[0]'}}}.
Also, if form defaults to ModelForm, then it is not obvious that
ModelForm.clean_myfield() will not be called and only Model.clean() will
be called.
It would be much clearer if there were an Admin Inline example where both
AdminInline.model and AdminInline.form were defined for the same class.
The '''best''' solution would be to have a detailed example for the Admin
validation precedence (including Inlines) similar to what is described for
the model validation.
--
Ticket URL: <https://code.djangoproject.com/ticket/20023#comment:1>
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.