From fd0b12a0099658a7448f489098d237ff7b504c65 Mon Sep 17 00:00:00 2001 From: rafalp Date: Sun, 18 Aug 2024 22:37:35 +0200 Subject: [PATCH] Fix thread urls errors --- misago/posting/tests/test_start_private_thread_view.py | 2 +- misago/threads/threadtypes/privatethread.py | 6 +++--- misago/threads/threadtypes/thread.py | 6 +++--- misago/threads/utils.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/misago/posting/tests/test_start_private_thread_view.py b/misago/posting/tests/test_start_private_thread_view.py index 24d3f9ff0c..ba43b99460 100644 --- a/misago/posting/tests/test_start_private_thread_view.py +++ b/misago/posting/tests/test_start_private_thread_view.py @@ -55,7 +55,7 @@ def test_start_private_thread_view_posts_new_thread(user_client, other_user): thread = Thread.objects.get(slug="hello-world") assert response["location"] == reverse( - "misago:private-thread", kwargs={"pk": thread.pk, "slug": thread.slug} + "misago:private-thread", kwargs={"id": thread.id, "slug": thread.slug} ) diff --git a/misago/threads/threadtypes/privatethread.py b/misago/threads/threadtypes/privatethread.py index dd8ec7c7ee..23d086e6fc 100644 --- a/misago/threads/threadtypes/privatethread.py +++ b/misago/threads/threadtypes/privatethread.py @@ -17,7 +17,7 @@ def get_category_absolute_url(self, category): def get_category_last_thread_url(self, category): return reverse( "misago:private-thread", - kwargs={"slug": category.last_thread_slug, "pk": category.last_thread_id}, + kwargs={"slug": category.last_thread_slug, "id": category.last_thread_id}, ) def get_category_last_thread_new_url(self, category): @@ -36,11 +36,11 @@ def get_thread_absolute_url(self, thread, page=1): if page > 1: return reverse( "misago:private-thread", - kwargs={"slug": thread.slug, "pk": thread.pk, "page": page}, + kwargs={"slug": thread.slug, "id": thread.id, "page": page}, ) return reverse( - "misago:private-thread", kwargs={"slug": thread.slug, "pk": thread.pk} + "misago:private-thread", kwargs={"slug": thread.slug, "id": thread.id} ) def get_thread_last_post_url(self, thread): diff --git a/misago/threads/threadtypes/thread.py b/misago/threads/threadtypes/thread.py index 9ff1d68975..db941b51cb 100644 --- a/misago/threads/threadtypes/thread.py +++ b/misago/threads/threadtypes/thread.py @@ -26,7 +26,7 @@ def get_category_absolute_url(self, category): def get_category_last_thread_url(self, category): return reverse( "misago:thread", - kwargs={"slug": category.last_thread_slug, "pk": category.last_thread_id}, + kwargs={"slug": category.last_thread_slug, "id": category.last_thread_id}, ) def get_category_last_thread_new_url(self, category): @@ -45,10 +45,10 @@ def get_thread_absolute_url(self, thread, page=1): if page > 1: return reverse( "misago:thread", - kwargs={"slug": thread.slug, "pk": thread.pk, "page": page}, + kwargs={"slug": thread.slug, "id": thread.id, "page": page}, ) - return reverse("misago:thread", kwargs={"slug": thread.slug, "pk": thread.pk}) + return reverse("misago:thread", kwargs={"slug": thread.slug, "id": thread.id}) def get_thread_last_post_url(self, thread): return reverse( diff --git a/misago/threads/utils.py b/misago/threads/utils.py index f9cc86dddc..5ea70c6e93 100644 --- a/misago/threads/utils.py +++ b/misago/threads/utils.py @@ -32,7 +32,7 @@ def add_likes_to_posts(user, posts): SUPPORTED_THREAD_ROUTES = { - "misago:thread": "pk", + "misago:thread": "id", "misago:thread-post": "pk", "misago:thread-last": "pk", "misago:thread-new": "pk",