[Django] #27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request or model instance.

15 views
Skip to first unread message

Django

unread,
Jan 21, 2017, 10:44:29 AM1/21/17
to django-...@googlegroups.com
#27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request
or model instance.
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
WeizhongTu |
Type: New | Status: new
feature |
Component: | Version: master
contrib.admin | Keywords:
Severity: Normal | django,admin,inlines
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
add ModelAdmin.get_inlines() hook to allow set inlines based on the
request or model instance.
Currently, We can override the method `get_inline_instances` to do such a
thing, but a for loop should be copied to my code. So I wished add a hook
`get_inlines(request, obj=None)`

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

Django

unread,
Jan 21, 2017, 11:21:17 AM1/21/17
to django-...@googlegroups.com
#27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request
or model instance.
-------------------------------------+-------------------------------------
Reporter: WeizhongTu | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
django,admin,inlines | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

Are you going to offer a patch to show exactly what you have in mind? I'm
not immediately convinced that another hook is needed since the cost of
duplicating a for loop is not that great.

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

Django

unread,
Jan 21, 2017, 8:53:21 PM1/21/17
to django-...@googlegroups.com
#27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request
or model instance.
-------------------------------------+-------------------------------------
Reporter: WeizhongTu | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
django,admin,inlines | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by WeizhongTu):

If I want to realize a dynamic inlines based on the request or model
instance. I need to override `get_inline_instances` to do it.
What I want to do is just set `self.inlines` to dynamic values according
to different person or object. not `inline instances`, so I advise to add
a new hook `get_inlines(request, obj=None)` to finish such a thing.

Replying to [comment:1 Tim Graham]:


> Are you going to offer a patch to show exactly what you have in mind?
I'm not immediately convinced that another hook is needed since the cost
of duplicating a for loop is not that great.

--
Ticket URL: <https://code.djangoproject.com/ticket/27755#comment:2>

Django

unread,
Jan 21, 2017, 11:03:06 PM1/21/17
to django-...@googlegroups.com
#27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request
or model instance.
-------------------------------------+-------------------------------------
Reporter: WeizhongTu | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
django,admin,inlines | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by WeizhongTu):

I've already created a new pull request here:
https://github.com/django/django/pull/7920

Replying to [comment:1 Tim Graham]:
> Are you going to offer a patch to show exactly what you have in mind?
I'm not immediately convinced that another hook is needed since the cost
of duplicating a for loop is not that great.

--
Ticket URL: <https://code.djangoproject.com/ticket/27755#comment:3>

Django

unread,
Jan 24, 2017, 11:36:35 AM1/24/17
to django-...@googlegroups.com
#27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request
or model instance.
--------------------------------------+------------------------------------

Reporter: WeizhongTu | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: django,admin,inlines | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

I guess it's useful. The patch needs some improvement (tests, some doc
fixes such as release notes) as per the PatchReviewChecklist.

Django

unread,
Nov 18, 2018, 4:50:56 PM11/18/18
to django-...@googlegroups.com
#27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request
or model instance.
-------------------------------------+-------------------------------------
Reporter: WeizhongTu | Owner: Hidde
| Bultsma
Type: New feature | Status: assigned

Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
django,admin,inlines |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* owner: nobody => Hidde Bultsma
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/27755#comment:4>

Django

unread,
Mar 19, 2019, 11:46:05 AM3/19/19
to django-...@googlegroups.com
#27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request
or model instance.
-------------------------------------+-------------------------------------
Reporter: WeizhongTu | Owner: Hasan
| Ramezani

Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
django,admin,inlines |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* owner: Hidde Bultsma => Hasan Ramezani
* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/27755#comment:5>

Django

unread,
Apr 16, 2019, 5:02:16 AM4/16/19
to django-...@googlegroups.com
#27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request
or model instance.
-------------------------------------+-------------------------------------
Reporter: WeizhongTu | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
django,admin,inlines | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/27755#comment:6>

Django

unread,
Apr 17, 2019, 1:34:16 AM4/17/19
to django-...@googlegroups.com
#27755: add ModelAdmin.get_inlines() hook to allow set inlines based on the request
or model instance.
-------------------------------------+-------------------------------------
Reporter: WeizhongTu | Owner: Hasan
| Ramezani
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
django,admin,inlines | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"917fd9d03fdd21538864af4b412ac30b36d99268" 917fd9d0]:
{{{
#!CommitTicketReference repository=""
revision="917fd9d03fdd21538864af4b412ac30b36d99268"
Fixed #27755 -- Added ModelAdmin.get_inlines() hook.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27755#comment:7>

Reply all
Reply to author
Forward
0 new messages