Skip to content

Feature Request: Selected IDs Not Available in changelist_action via actions_list #1357

@Punith-B-Chandakavate

Description

@Punith-B-Chandakavate

Summary:
We are using actions_list = ['changelist_action'] in our ModelAdmin and defining the action like this:

Image

However, when selecting rows in the changelist view and triggering this action from actions_list, the selected IDs are not passed to the action function.

✅ Expected Behavior
When checkboxes are selected on the changelist view and the action is triggered from actions_list, the selected object IDs (_selected_action) should be sent in the POST request.

Inside the action function, we should be able to access them via:

selected_ids = request.POST.getlist('_selected_action')

❌ Actual Behavior
The request.POST.getlist('_selected_action') is empty.

There’s currently no way to retrieve the selected object IDs when the action is triggered from actions_list.

📌 Why This Matters
This feature is essential for bulk actions like:

  • Marking selected objects as active/inactive
  • Assigning selected records to a different group/category
  • Exporting selected data
    Without access to selected IDs, actions_list is currently only useful for global actions rather than selected-object operations.

💡 Suggested Fix
Update the frontend JavaScript to include the selected checkboxes (_selected_action) in the form data when submitting an actions_list action.

Ensure the backend action receives these IDs.

🛠 Version Info
Django: 5.2
Django-unfold: 0.56.0

Thanks a lot for this great project! Looking forward to selected IDs being supported in actions_list actions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions