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

Split out a method for getting json_data to pass to chooser view

This commit is contained in:
Matt Westcott 2022-06-28 23:09:47 +01:00 committed by Matt Westcott
parent b301fb17a7
commit 16ea847aca
2 changed files with 13 additions and 7 deletions

View File

@ -244,6 +244,11 @@ class ChooseViewMixin:
return context
def get_response_json_data(self):
return {
"step": "choose",
}
# Return the choose view as a ModalWorkflow response
def render_to_response(self):
return render_modal_workflow(
@ -251,9 +256,7 @@ class ChooseViewMixin:
self.template_name,
None,
self.get_context_data(),
json_data={
"step": "choose",
},
json_data=self.get_response_json_data(),
)

View File

@ -220,16 +220,19 @@ class DocumentChooseViewMixin:
)
return context
def get_response_json_data(self):
return {
"step": "choose",
"tag_autocomplete_url": reverse("wagtailadmin_tag_autocomplete"),
}
def render_to_response(self):
return render_modal_workflow(
self.request,
self.template_name,
None,
self.get_context_data(),
json_data={
"step": "choose",
"tag_autocomplete_url": reverse("wagtailadmin_tag_autocomplete"),
},
json_data=self.get_response_json_data(),
)