From 9b93b43c32aa73303d2702c12d9b3abf2bbf233f Mon Sep 17 00:00:00 2001 From: Arnaud-D <35631001+Arnaud-D@users.noreply.github.com> Date: Sun, 15 Oct 2023 21:25:00 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Modifie=20DeleteImages=20en=20pr=C3=A9parat?= =?UTF-8?q?ion=20pour=20Django=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zds/gallery/views.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/zds/gallery/views.py b/zds/gallery/views.py index c652836063..75e6130c03 100644 --- a/zds/gallery/views.py +++ b/zds/gallery/views.py @@ -4,7 +4,7 @@ from django.core.exceptions import PermissionDenied from django.urls import reverse from django.http import Http404, HttpResponseRedirect -from django.views.generic import DeleteView, FormView, View +from django.views.generic import FormView, View from django.shortcuts import redirect, get_object_or_404 from django.utils.translation import gettext_lazy as _ from django.contrib.auth.mixins import LoginRequiredMixin @@ -398,24 +398,23 @@ def form_valid(self, form): return super().form_valid(form) -class DeleteImages(ImageFromGalleryViewMixin, ImageUpdateOrDeleteMixin, LoggedWithReadWriteHability, DeleteView): +class DeleteImages(ImageFromGalleryViewMixin, ImageUpdateOrDeleteMixin, LoggedWithReadWriteHability, View): """Delete a given image""" model = Image - http_method_names = ["post", "delete"] + http_method_names = ["post"] must_write = True - def delete(self, request, *args, **kwargs): + def post(self, request, *args, **kwargs): if "delete_multi" in request.POST: list_items = request.POST.getlist("g_items") Image.objects.filter(pk__in=list_items, gallery=self.gallery).delete() elif "delete" in request.POST: try: - self.get_image(self.request.POST.get("image")) + self.get_image(request.POST.get("image")) self.perform_delete() except Image.DoesNotExist: raise Http404() - return redirect(self.gallery.get_absolute_url()) From 91fe3192059dd3fc0b07d90943e6e6e2b8232b0a Mon Sep 17 00:00:00 2001 From: Arnaud-D <35631001+Arnaud-D@users.noreply.github.com> Date: Thu, 18 Jan 2024 20:38:12 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Supprime=20un=20`print`=20oubli=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zds/tutorialv2/views/display/container.py | 1 - 1 file changed, 1 deletion(-) diff --git a/zds/tutorialv2/views/display/container.py b/zds/tutorialv2/views/display/container.py index c8f99b93d1..e041ef87e1 100644 --- a/zds/tutorialv2/views/display/container.py +++ b/zds/tutorialv2/views/display/container.py @@ -72,7 +72,6 @@ def get_context_data(self, **kwargs): context["base_url"] = self.get_base_url() container = search_container_or_404(self.versioned_object, self.kwargs) context["breadcrumb_items"] = self.get_breadcrumbs(container) - print(context["breadcrumb_items"]) context["containers_target"] = get_target_tagged_tree(container, self.versioned_object) context["form_warn_typo"] = WarnTypoForm( self.versioned_object,