Fix /banned/ page redirect error

The URL routing for /banned/ was going to the board controller because it
would match /banned/ as a board URL rather than its verbatim value. This
is fixed by moving the board route match to the bottom of the URL
routing list.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-07-17 15:47:46 -07:00
parent 794db714de
commit 1a2ac653d7

View File

@@ -9,13 +9,6 @@ app_name = "board"
urlpatterns = [
# News views
path("news/", NewsListView.as_view(), name="board_news"),
# Board views
path("<slug:url>/", BoardView.as_view(), name="board_detail"),
path("<slug:url>/page/<int:page>/", BoardView.as_view(), name="board_detail"),
path("<slug:url>/post/<int:id>/", PostView.as_view(), name="post_detail"),
path("<slug:url>/post/create/", PostCreateView.as_view(), name="post_create"),
path("<slug:url>/reply/<int:id>/", ReplyCreateView.as_view(), name="reply_create"),
path("post/success/", PostSuccessView.as_view(), name="post_success"),
# Reports
path("report/<slug:url>/<int:id>/", ReportView.as_view(), name="report_form"),
path(
@@ -49,6 +42,14 @@ urlpatterns = [
ActionSuccessView.as_view(window_timeout=settings.ACTION_SUCCESS_CLOSE_TIMEOUT),
name="post_delete_success",
),
# Board views
path("post/success/", PostSuccessView.as_view(), name="post_success"),
path("<slug:url>/page/<int:page>/", BoardView.as_view(), name="board_detail"),
path("<slug:url>/post/<int:id>/", PostView.as_view(), name="post_detail"),
path("<slug:url>/post/create/", PostCreateView.as_view(), name="post_create"),
path("<slug:url>/reply/<int:id>/", ReplyCreateView.as_view(), name="reply_create"),
# This has to go very last, so that things like banned/ page works
path("<slug:url>/", BoardView.as_view(), name="board_detail"),
]
# TODO - make this conditional so we can serve images up with whatever server we want
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)