0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Make a can_create flag available on the generic chooser view

to be used for "would you like to create one now?" messages
This commit is contained in:
Matt Westcott 2022-06-28 22:33:56 +01:00 committed by Matt Westcott
parent 84cb4b6ffa
commit f83357eea2

View File

@ -137,6 +137,7 @@ class BaseChooseView(ModalPageFurnitureMixin, ContextMixin, View):
"results_url": self.get_results_url(),
"is_searching": self.is_searching,
"search_query": self.search_query,
"can_create": self.can_create(),
}
)
return context
@ -236,7 +237,7 @@ class ChooseViewMixin:
}
)
if self.can_create():
if context["can_create"]:
creation_form = self.get_creation_form()
if creation_form:
context.update(self.get_creation_form_context_data(creation_form))