From 908d088b3ec1467b04ac34bc7a11c0aaa39df6b6 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Fri, 1 Jul 2022 19:22:05 +0100 Subject: [PATCH] further cleanup of attributes/methods that belong in ImageCreationFormMixin --- wagtail/images/views/chooser.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/wagtail/images/views/chooser.py b/wagtail/images/views/chooser.py index 947245496e..7ba239cb8a 100644 --- a/wagtail/images/views/chooser.py +++ b/wagtail/images/views/chooser.py @@ -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(