kopia lustrzana https://github.com/wagtail/wagtail
[feat] Add action dispatcher for images bulk actions
rodzic
e0ce91f035
commit
855591cf8f
|
@ -1,6 +1,6 @@
|
|||
from django.urls import path
|
||||
|
||||
from wagtail.images.views import chooser, images, multiple
|
||||
from wagtail.images.views import bulk_actions, chooser, images, multiple
|
||||
|
||||
|
||||
app_name = 'wagtailimages'
|
||||
|
@ -26,4 +26,6 @@ urlpatterns = [
|
|||
path('chooser/<int:image_id>/', chooser.image_chosen, name='image_chosen'),
|
||||
path('chooser/upload/', chooser.chooser_upload, name='chooser_upload'),
|
||||
path('chooser/<int:image_id>/select_format/', chooser.chooser_select_format, name='chooser_select_format'),
|
||||
|
||||
path('multiple/<str:action>/', bulk_actions.index, name='image_bulk_action'),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from .add_tags import add_tags
|
||||
from .add_to_collection import add_to_collection
|
||||
from .delete import delete
|
||||
from .dispatcher import index
|
||||
|
||||
|
||||
__all__ = ['add_tags', 'add_to_collection', 'delete']
|
||||
__all__ = ['add_tags', 'add_to_collection', 'delete', 'index']
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
from django.http.response import Http404
|
||||
|
||||
from wagtail.core import hooks
|
||||
|
||||
|
||||
def index(request, action):
|
||||
bulk_actions = hooks.get_hooks('register_image_bulk_action')
|
||||
for action_func in bulk_actions:
|
||||
_action = action_func(request)
|
||||
if _action.action_type != action:
|
||||
continue
|
||||
return _action.dispatch(request)
|
||||
|
||||
return Http404()
|
Ładowanie…
Reference in New Issue