[Django] #25130: Add the ability to specify custom inlinemodeladmin form

6 views
Skip to first unread message

Django

unread,
Jul 15, 2015, 10:42:48 PM7/15/15
to django-...@googlegroups.com
#25130: Add the ability to specify custom inlinemodeladmin form
-------------------------------+--------------------
Reporter: burhan | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Similar to how `get_form` allows customization of the admin form, there
should be a way to customize the inline admin forms.

For example, if there is custom validation that needs to be done on the
individual inline forms (for example, to raise a `ValidationError`) this
cannot be done easily currently.

I am right now experimenting with `get_formsets_with_inlines` to modify
the individual formsets' forms, but this feels very hackish and I'm not
sure what other side-effects this will have.

--
Ticket URL: <https://code.djangoproject.com/ticket/25130>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 15, 2015, 11:21:13 PM7/15/15
to django-...@googlegroups.com
#25130: Add the ability to specify custom inlinemodeladmin form
-------------------------------+--------------------------------------
Reporter: burhan | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 1.8
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by burhan):

* status: new => closed
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
* resolution: => invalid


Old description:

> Similar to how `get_form` allows customization of the admin form, there
> should be a way to customize the inline admin forms.
>
> For example, if there is custom validation that needs to be done on the
> individual inline forms (for example, to raise a `ValidationError`) this
> cannot be done easily currently.
>
> I am right now experimenting with `get_formsets_with_inlines` to modify
> the individual formsets' forms, but this feels very hackish and I'm not
> sure what other side-effects this will have.

New description:

After going through the documentation a few more times, the answer is that
unlike ModelAdmin, the InlineAdmins have a [`.form`
property](https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.form)
that can be used to control which form is being passed to the factory.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25130#comment:1>

Reply all
Reply to author
Forward
0 new messages