Files
interchan/board/urls.py
Alek Ratzloff 412ae8f632 Add "boards" context processor
This adds the "boards" context data to all pages, so they can render the
boards nav page.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-17 19:49:17 -07:00

74 lines
2.7 KiB
Python

from django.conf import settings
from django.conf.urls.static import static
from django.urls import path
from django.utils.translation import gettext as _
from django.views.generic.base import TemplateView
from board.views import *
app_name = "board"
urlpatterns = [
# Index
path("", TemplateView.as_view(template_name="board/home.html"), name="home"),
# News views
path("news/", NewsListView.as_view(), name="news_list"),
# Rules views
path(
"rules/",
TemplateView.as_view(template_name="board/rules.html"),
name="rules_list",
),
# Reports
path("report/<slug:url>/<int:id>/", ReportView.as_view(), name="report_form"),
path(
"report/success/",
ActionSuccessView.as_view(
window_timeout=settings.REPORT_WINDOW_CLOSE_TIMEOUT,
message=_("Post reported."),
),
name="report_success",
),
# Bans
path("ban/<slug:url>/<int:id>/", BanCreateView.as_view(), name="ban_create"),
path(
"ban/success/",
BanSuccessView.as_view(window_timeout=settings.ACTION_SUCCESS_CLOSE_TIMEOUT),
name="ban_success",
),
path("banned/", BannedView.as_view(), name="banned"),
# Other moderation pages
path("modify/<int:pk>/", PostModifyView.as_view(), name="post_modify"),
path(
"modify/success/",
PostModifySuccessView.as_view(
window_timeout=settings.ACTION_SUCCESS_CLOSE_TIMEOUT
),
name="post_modify_success",
),
path("post/delete/<int:pk>/", PostDeleteView.as_view(), name="post_delete"),
path(
"post/delete/success/",
ActionSuccessView.as_view(window_timeout=settings.ACTION_SUCCESS_CLOSE_TIMEOUT),
name="post_delete_success",
),
path("post/wipe/<int:pk>/", PostWipeView.as_view(), name="post_wipe"),
path(
"post/wipe/success/",
ActionSuccessView.as_view(
window_timeout=settings.ACTION_SUCCESS_CLOSE_TIMEOUT, message="Posts wiped."
),
name="post_wipe_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)