Article Bulk Actions

Example Overview

This example uses django_tomselect to select multiple articles and apply bulk actions such as publishing, archiving, or assigning categories and authors. Filters for date range, category, and status dynamically narrow the multi-select list, and the action-specific fields appear only when relevant. Use this pattern for editorial or moderation tools that operate on many records at once.

Visual Examples

Screenshot: Article Bulk Actions Screenshot: Article Bulk Actions


Key Code Segments

Forms

The bulk action form combines filters and actions with dynamic dropdowns for flexible workflows.


Templates

The form is rendered dynamically in the template, allowing users to filter articles and apply actions. When filters change, the article list updates accordingly via HTMX.

Main Template

Tables Template


Autocomplete Views

Multiple autocomplete views are used to populate the dropdowns with dynamic data, such as categories, authors, and article statuses. Please see the example app’s Autocomplete Views Code for more details.


Views

We use two views to handle the bulk actions and filtered article table. The article_bulk_action_view processes the bulk actions, while article_filtered_table returns the filtered articles table HTML.


Implementation Notes

  • PluginDropdownHeader provides additional metadata for each dropdown (e.g., category total articles).

  • Target fields like “Category” or “Author” are conditionally required based on the action type, ensuring flexibility.