Skip to content

Commit

Permalink
refactor(forum_conversation/view_mixins.py): enlève get_url_encoded_p…
Browse files Browse the repository at this point in the history
…arams
  • Loading branch information
calummackervoy committed Jun 12, 2024
1 parent 1a6196e commit b4d3c86
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions lacommunaute/forum_conversation/view_mixins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from urllib.parse import urlencode

from taggit.models import Tag

from lacommunaute.forum_conversation.enums import Filters
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit b4d3c86

Please sign in to comment.