-
Notifications
You must be signed in to change notification settings - Fork 317
Description
Summary:
We are using actions_list = ['changelist_action'] in our ModelAdmin and defining the action like this:
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.
