mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-21 21:41:55 +00:00
Added before_create_page hook
This commit is contained in:
parent
5732e215b0
commit
d61f91be7c
1 changed files with 5 additions and 0 deletions
|
|
@ -179,6 +179,11 @@ def create(request, content_type_app_name, content_type_model_name, parent_page_
|
|||
if not page_class.can_create_at(parent_page):
|
||||
raise PermissionDenied
|
||||
|
||||
for fn in hooks.get_hooks('before_create_page'):
|
||||
result = fn(request, parent_page, page_class)
|
||||
if hasattr(result, 'status_code'):
|
||||
return result
|
||||
|
||||
page = page_class(owner=request.user)
|
||||
edit_handler_class = page_class.get_edit_handler()
|
||||
form_class = edit_handler_class.get_form_class(page_class)
|
||||
|
|
|
|||
Loading…
Reference in a new issue