From b4d3c866a808a143001b3b501e65e95252d0de57 Mon Sep 17 00:00:00 2001 From: Calum Mackervoy Date: Wed, 12 Jun 2024 15:27:38 +0200 Subject: [PATCH] =?UTF-8?q?refactor(forum=5Fconversation/view=5Fmixins.py)?= =?UTF-8?q?:=20enl=C3=A8ve=20get=5Furl=5Fencoded=5Fparams?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lacommunaute/forum_conversation/view_mixins.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lacommunaute/forum_conversation/view_mixins.py b/lacommunaute/forum_conversation/view_mixins.py index fc9fc78d5..a3daa3986 100644 --- a/lacommunaute/forum_conversation/view_mixins.py +++ b/lacommunaute/forum_conversation/view_mixins.py @@ -1,5 +1,3 @@ -from urllib.parse import urlencode - from taggit.models import Tag from lacommunaute.forum_conversation.enums import Filters @@ -38,22 +36,14 @@ def get_tags(self, flat=None): return ",".join(tag.slug for tag in self.tags) return self.tags - def get_url_encoded_params(self): - return urlencode( - { - k: v - for k, v in {"filter": self.request.GET.get("filter"), "tags": self.get_tags(flat="slug")}.items() - if v - } - ) - def get_load_more_url(self, url): """ :return: a URL for pagination """ - encoded_params = self.get_url_encoded_params() - if encoded_params: - url += f"?{encoded_params}" + if self.request.GET: + params = self.request.GET.copy() + params.pop("page", None) + url += f"?{params.urlencode()}" return url def get_topic_filter_context(self):