[Django] #37176: Action should be importable from django.contrib.admin.

5 views
Skip to first unread message

Django

unread,
Jun 17, 2026, 8:08:53 AM (3 days ago) Jun 17
to django-...@googlegroups.com
#37176: Action should be importable from django.contrib.admin.
-------------------------------------+-------------------------------------
Reporter: Mariusz | Owner: Mariusz Felisiak
Felisiak |
Type: Bug | Status: assigned
Component: | Version: 6.1
contrib.admin |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The new `Action` class should be importable from `django.contrib.admin`
like `ActionLocation`.
--
Ticket URL: <https://code.djangoproject.com/ticket/37176>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 17, 2026, 8:28:16 AM (3 days ago) Jun 17
to django-...@googlegroups.com
#37176: Action should be importable from django.contrib.admin.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: contrib.admin | Version: 6.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Unreviewed => Accepted

Comment:

Thank you Mariusz, I think you proposal makes sense. I'm accepting but
could you share your use case in the ticket for future reference?
--
Ticket URL: <https://code.djangoproject.com/ticket/37176#comment:1>

Django

unread,
Jun 17, 2026, 8:41:55 AM (3 days ago) Jun 17
to django-...@googlegroups.com
#37176: Action should be importable from django.contrib.admin.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: contrib.admin | Version: 6.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):

Replying to [comment:1 Natalia Bidart]:
> Thank you Mariusz, I think you proposal makes sense. I'm accepting but
could you share your use case in the ticket for future reference?

Sure, I'm adding actions dynamically based on the queryset, so separate
action for each object, something like:

{{{#!python
def get_actions(
self,
request,
action_location=admin.ActionLocation.CHANGE_LIST,
):
actions: dict[str, admin.Action] = super().get_actions(
request,
action_location=action_location,
)
for some_obj in SomeModel.objects.all():
name = f"add_{some_obj.pk}"
description = f"Add {some_obj.name}"
actions[name] = admin.Action(
func=functools.partial(add_some_obj_action,
some_obj=some_obj),
name=name,
description=description,
plural_description=description,
locations=[
admin.ActionLocation.CHANGE_LIST,
admin.ActionLocation.CHANGE_FORM,
],
)
return actions
}}}
I was surprised that I can use `admin.ActionLocation` but not
`admin.Action`. The second thing is that our docs point to the
`django.contrib.admin` module, that's why `[source]` is not visible for
`Action`, check out
https://docs.djangoproject.com/en/6.1/ref/contrib/admin/actions/#action.
--
Ticket URL: <https://code.djangoproject.com/ticket/37176#comment:2>

Django

unread,
Jun 17, 2026, 11:04:24 AM (2 days ago) Jun 17
to django-...@googlegroups.com
#37176: Action should be importable from django.contrib.admin.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: contrib.admin | Version: 6.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* severity: Normal => Release blocker
* stage: Accepted => Ready for checkin

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

Django

unread,
Jun 17, 2026, 11:04:52 AM (2 days ago) Jun 17
to django-...@googlegroups.com
#37176: Action should be importable from django.contrib.admin.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: contrib.admin | Version: 6.1
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):

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

Comment:

In [changeset:"14988f14d94f9ce617f967d26b8ed2946172a140" 14988f14]:
{{{#!CommitTicketReference repository=""
revision="14988f14d94f9ce617f967d26b8ed2946172a140"
Fixed #37176 -- Made Action importable from django.contrib.admin.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37176#comment:4>

Django

unread,
Jun 17, 2026, 11:05:26 AM (2 days ago) Jun 17
to django-...@googlegroups.com
#37176: Action should be importable from django.contrib.admin.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: contrib.admin | Version: 6.1
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls <jacobtylerwalls@…>):

In [changeset:"f88a6292b38eb40b492afd354b760620c226b1b0" f88a6292]:
{{{#!CommitTicketReference repository=""
revision="f88a6292b38eb40b492afd354b760620c226b1b0"
[6.1.x] Fixed #37176 -- Made Action importable from django.contrib.admin.

Backport of 14988f14d94f9ce617f967d26b8ed2946172a140 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37176#comment:5>
Reply all
Reply to author
Forward
0 new messages