0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

further cleanup of attributes/methods that belong in ImageCreationFormMixin

This commit is contained in:
Matt Westcott 2022-07-01 19:22:05 +01:00 committed by Matt Westcott
parent 1b5bf70991
commit 908d088b3e

View File

@ -76,6 +76,12 @@ class ImageCreationFormMixin(CreationFormMixin):
def get_creation_form_class(self):
return get_image_form(self.model)
def get_create_url(self):
url = super().get_create_url()
if self.request.GET.get("select_format"):
url += "?select_format=true"
return url
def get_creation_form_kwargs(self):
kwargs = super().get_creation_form_kwargs()
kwargs.update(
@ -123,12 +129,6 @@ class BaseImageChooseView(BaseChooseView):
FilterForm = self.get_filter_form_class()
return FilterForm(self.request.GET, collections=self.collections)
def get_create_url(self):
url = reverse(self.create_url_name)
if self.request.GET.get("select_format"):
url += "?select_format=true"
return url
def filter_object_list(self, images, form):
collection_id = form.cleaned_data.get("collection_id")
if collection_id:
@ -198,10 +198,6 @@ class ChooserUploadView(
PermissionCheckedMixin, ImageCreationFormMixin, ImageChosenResponseMixin, View
):
permission_required = "add"
creation_tab_id = "upload"
create_url_name = "wagtailimages:chooser_upload"
create_action_label = _("Upload")
create_action_clicked_label = _("Uploading…")
def get(self, request):
self.model = get_image_model()
@ -281,12 +277,6 @@ class ChooserUploadView(
},
)
def get_create_url(self):
url = reverse(self.create_url_name)
if self.request.GET.get("select_format"):
url += "?select_format=true"
return url
def get_reshow_creation_form_response(self):
context = self.get_creation_form_context_data(self.form)
upload_form_html = render_to_string(