#10505 closed (fixed)
Integrate django-batchadmin
Reported by: | Jannis Leidel | Owned by: | Jacob |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | ||
Cc: | Martin Mahner | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The integration of django-batchadmin is one of the "maby" features of 1.1 (Admin-02).
It allows the user to define lists of callables in ModelAdmin classes that are used to perform custom actions on a list of objects retrieved from checkbox inputs.
Attachments (10)
Change History (18)
by , 16 years ago
Attachment: | admin-actions.1.diff added |
---|
comment:1 by , 16 years ago
Has patch: | set |
---|---|
Needs documentation: | set |
Needs tests: | set |
Owner: | changed from | to
Status: | new → assigned |
The current code can also be found at Github, http://github.com/jezdez/django/commits/admin-actions.
The code differs from django-batchadmin in multiple ways:
- Removed dependency on jQuery, added unobtrusive Actions code
- Replaced select/deselect button with global checkbox (screenshot: http://www.quicksnapper.com/jezdez/image/batchadmin)
- Added ability to directly use callables as actions, also looks in model class for action with given name (~list_display)
- Fixes various bugs in batchadmin regarding non-ASCII data, e.g. i18n
Needs tests and docs
comment:2 by , 16 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 16 years ago
milestone: | 1.1 → 1.1 beta |
---|---|
Owner: | changed from | to
Status: | assigned → new |
by , 16 years ago
Attachment: | admin-actions.2.diff added |
---|
Refactored action loading and choices. Only the queryset of the selection is passed to actions (in model admin methods and function) now. Model methods don't get the whole queryset anymore but are called each (~obj.action()). Added tests, yay!
by , 16 years ago
Attachment: | admin-actions.4.diff added |
---|
Fixed redundancy in condition with callable_actions dictionary
by , 16 years ago
Attachment: | admin-actions.5.diff added |
---|
Isolated the logic to look for callable actions inside the get_action method
by , 16 years ago
Attachment: | admin-actions.6.diff added |
---|
Updated to work with merged list_editable code. Now only passes the queryset to response_action method and fixes some stylesheet issues.
comment:4 by , 16 years ago
Oh, the last patch also includes a better default delete action that will ask for confirmation before deleting, courtesy of Martin Mahner.
by , 16 years ago
Attachment: | admin-actions.7.diff added |
---|
Fixed problem with URLs in delete_selected action in a backwards compatible way.
comment:5 by , 16 years ago
There's a set of usecases I shared with jezdez that I want this to solve; posting 'em here for posterity:
- I want to be able to add an action to a particular modeladmin and have that action available. I assume this works :)
- I want to be able to create an abstract ModelAdmin subclass -- think GeoAdmin -- that has actions available to any admin registered with that subclass or any of *its* subclasses.
- I want to be able to define some abstract function and make it available for anyone who wants to use it as an action on some modeladmin I don't know anything about (this is the reusable app usecase).
- I want to be able to create an action that's available on every registered model on my site that doesn't explicitly exclude that action. Think a "csv export" reusable app that provides an "Export" feature on every changelist.
- Finally, I want to be able to reach in and dynamically add an action to some other model admin -- think reaching in and adding a "ban this user" action to UserAdmin.
comment:6 by , 16 years ago
Cc: | added |
---|
by , 16 years ago
Attachment: | admin-actions.8.diff added |
---|
URL resolving now takes care of AdminSite's
by , 16 years ago
Attachment: | admin-actions.9.diff added |
---|
Refactored get_action code. Removed support for model level actions. Added ability to add actions to all model admins of a admin site. Subclasses are now loaded from subclasses, too (get_actions). Now passes the request to get_actions and get_action_choices, e.g. for user permission dependent actions. Courtesy of Alex Gaynor
by , 16 years ago
Attachment: | admin-actions.diff added |
---|
comment:7 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [10121]) Fixed #10505: added support for bulk admin actions, including a globally-available "delete selected" action. See the documentation for details.
This work started life as Brian Beck's "django-batchadmin." It was rewritten for inclusion in Django by Alex Gaynor, Jannis Leidel (jezdez), and Martin Mahner (bartTC). Thanks, guys!
Initial patch, partly based on django-batchadmin