2023-04-06 11:08:42 +00:00
|
|
|
# -*- coding:utf-8 -*-
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
2023-04-06 11:08:42 +00:00
|
|
|
# Copyright 2023 © AE UTBM
|
|
|
|
# ae@utbm.fr / ae.info@utbm.fr
|
|
|
|
# All contributors are listed in the CONTRIBUTORS file.
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
2023-04-06 11:08:42 +00:00
|
|
|
# This file is part of the website of the UTBM Student Association (AE UTBM),
|
|
|
|
# https://ae.utbm.fr.
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
2023-04-06 11:08:42 +00:00
|
|
|
# You can find the whole source code at https://github.com/ae-utbm/sith3
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
2023-04-06 11:08:42 +00:00
|
|
|
# LICENSED UNDER THE GNU GENERAL PUBLIC LICENSE VERSION 3 (GPLv3)
|
|
|
|
# SEE : https://raw.githubusercontent.com/ae-utbm/sith3/master/LICENSE
|
|
|
|
# OR WITHIN THE LOCAL FILE "LICENSE"
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
2023-04-06 11:08:42 +00:00
|
|
|
# PREVIOUSLY LICENSED UNDER THE MIT LICENSE,
|
|
|
|
# SEE : https://raw.githubusercontent.com/ae-utbm/sith3/master/LICENSE.old
|
|
|
|
# OR WITHIN THE LOCAL FILE "LICENSE.old"
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
|
|
|
|
2023-01-09 21:07:03 +00:00
|
|
|
from django.urls import path, re_path, register_converter
|
2015-11-18 08:44:06 +00:00
|
|
|
|
2023-01-09 21:07:03 +00:00
|
|
|
from core.converters import (
|
2024-06-24 11:07:36 +00:00
|
|
|
BooleanStringConverter,
|
2023-01-09 21:07:03 +00:00
|
|
|
FourDigitYearConverter,
|
|
|
|
TwoDigitMonthConverter,
|
|
|
|
)
|
2024-06-24 11:07:36 +00:00
|
|
|
from core.views import *
|
2023-01-09 21:07:03 +00:00
|
|
|
|
|
|
|
register_converter(FourDigitYearConverter, "yyyy")
|
|
|
|
register_converter(TwoDigitMonthConverter, "mm")
|
|
|
|
register_converter(BooleanStringConverter, "bool")
|
|
|
|
|
2015-11-18 08:44:06 +00:00
|
|
|
|
|
|
|
urlpatterns = [
|
2023-01-09 21:07:03 +00:00
|
|
|
path("", index, name="index"),
|
|
|
|
path("to_markdown/", ToMarkdownView.as_view(), name="to_markdown"),
|
|
|
|
path("notifications/", NotificationList.as_view(), name="notification_list"),
|
|
|
|
path("notification/<int:notif_id>/", notification, name="notification"),
|
2016-08-24 17:50:22 +00:00
|
|
|
# Search
|
2023-01-09 21:07:03 +00:00
|
|
|
path("search/", search_view, name="search"),
|
|
|
|
path("search_json/", search_json, name="search_json"),
|
|
|
|
path("search_user/", search_user_json, name="search_user"),
|
2015-12-08 16:22:50 +00:00
|
|
|
# Login and co
|
2023-01-09 21:07:03 +00:00
|
|
|
path("login/", SithLoginView.as_view(), name="login"),
|
|
|
|
path("logout/", logout, name="logout"),
|
|
|
|
path("password_change/", SithPasswordChangeView.as_view(), name="password_change"),
|
|
|
|
path(
|
|
|
|
"password_change/<int:user_id>/",
|
2018-10-04 19:29:19 +00:00
|
|
|
password_root_change,
|
|
|
|
name="password_root_change",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"password_change/done/",
|
2019-10-06 01:02:17 +00:00
|
|
|
SithPasswordChangeDoneView.as_view(),
|
|
|
|
name="password_change_done",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path("password_reset/", SithPasswordResetView.as_view(), name="password_reset"),
|
|
|
|
path(
|
|
|
|
"password_reset/done/",
|
2019-10-06 01:02:17 +00:00
|
|
|
SithPasswordResetDoneView.as_view(),
|
|
|
|
name="password_reset_done",
|
2019-10-05 16:14:41 +00:00
|
|
|
),
|
2022-08-03 22:26:43 +00:00
|
|
|
path(
|
|
|
|
r"reset/<str:uidb64>/<str:token>/",
|
2019-10-06 01:02:17 +00:00
|
|
|
SithPasswordResetConfirmView.as_view(),
|
2018-10-04 19:29:19 +00:00
|
|
|
name="password_reset_confirm",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"reset/done/",
|
2019-10-06 01:02:17 +00:00
|
|
|
SithPasswordResetCompleteView.as_view(),
|
|
|
|
name="password_reset_complete",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path("register/", register, name="register"),
|
2015-12-08 16:22:50 +00:00
|
|
|
# Group handling
|
2023-01-09 21:07:03 +00:00
|
|
|
path("group/", GroupListView.as_view(), name="group_list"),
|
|
|
|
path("group/new/", GroupCreateView.as_view(), name="group_new"),
|
|
|
|
path("group/<int:group_id>/", GroupEditView.as_view(), name="group_edit"),
|
|
|
|
path(
|
|
|
|
"group/<int:group_id>/delete/",
|
2018-10-04 19:29:19 +00:00
|
|
|
GroupDeleteView.as_view(),
|
|
|
|
name="group_delete",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"group/<int:group_id>/detail/",
|
2019-04-09 23:22:00 +00:00
|
|
|
GroupTemplateView.as_view(),
|
2018-04-26 16:33:10 +00:00
|
|
|
name="group_detail",
|
|
|
|
),
|
2015-12-08 16:22:50 +00:00
|
|
|
# User views
|
2023-01-09 21:07:03 +00:00
|
|
|
path("user/", UserListView.as_view(), name="user_list"),
|
|
|
|
path(
|
|
|
|
"user/<int:user_id>/mini/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserMiniView.as_view(),
|
|
|
|
name="user_profile_mini",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path("user/<int:user_id>/", UserView.as_view(), name="user_profile"),
|
|
|
|
path(
|
|
|
|
"user/<int:user_id>/pictures/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserPicturesView.as_view(),
|
|
|
|
name="user_pictures",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"user/<int:user_id>/godfathers/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserGodfathersView.as_view(),
|
|
|
|
name="user_godfathers",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"user/<int:user_id>/godfathers/tree/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserGodfathersTreeView.as_view(),
|
|
|
|
name="user_godfathers_tree",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"user/<int:user_id>/godfathers/tree/pict/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserGodfathersTreePictureView.as_view(),
|
|
|
|
name="user_godfathers_tree_pict",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"user/<int:user_id>/godfathers/<int:godfather_id>/<bool:is_father>/delete/",
|
|
|
|
delete_user_godfather,
|
2018-10-04 19:29:19 +00:00
|
|
|
name="user_godfathers_delete",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"user/<int:user_id>/edit/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserUpdateProfileView.as_view(),
|
|
|
|
name="user_edit",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"user/<int:user_id>/profile_upload/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserUploadProfilePictView.as_view(),
|
|
|
|
name="user_profile_upload",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path("user/<int:user_id>/clubs/", UserClubView.as_view(), name="user_clubs"),
|
|
|
|
path(
|
|
|
|
"user/<int:user_id>/prefs/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserPreferencesView.as_view(),
|
|
|
|
name="user_prefs",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"user/<int:user_id>/groups/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserUpdateGroupView.as_view(),
|
|
|
|
name="user_groups",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path("user/tools/", UserToolsView.as_view(), name="user_tools"),
|
|
|
|
path(
|
|
|
|
"user/<int:user_id>/account/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserAccountView.as_view(),
|
|
|
|
name="user_account",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"user/<int:user_id>/account/<yyyy:year>/<mm:month>/",
|
2018-10-04 19:29:19 +00:00
|
|
|
UserAccountDetailView.as_view(),
|
|
|
|
name="user_account_detail",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path("user/<int:user_id>/stats/", UserStatsView.as_view(), name="user_stats"),
|
|
|
|
path(
|
|
|
|
"user/<int:user_id>/gift/create/",
|
2018-10-04 19:29:19 +00:00
|
|
|
GiftCreateView.as_view(),
|
|
|
|
name="user_gift_create",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"user/<int:user_id>/gift/delete/<int:gift_id>/",
|
2018-10-04 19:29:19 +00:00
|
|
|
GiftDeleteView.as_view(),
|
|
|
|
name="user_gift_delete",
|
|
|
|
),
|
2016-08-10 03:48:06 +00:00
|
|
|
# File views
|
2019-10-05 16:14:41 +00:00
|
|
|
re_path(r"^file/(?P<popup>popup)?$", FileListView.as_view(), name="file_list"),
|
|
|
|
re_path(
|
2018-10-04 19:29:19 +00:00
|
|
|
r"^file/(?P<file_id>[0-9]+)/(?P<popup>popup)?$",
|
|
|
|
FileView.as_view(),
|
|
|
|
name="file_detail",
|
|
|
|
),
|
2019-10-05 16:14:41 +00:00
|
|
|
re_path(
|
2018-10-04 19:29:19 +00:00
|
|
|
r"^file/(?P<file_id>[0-9]+)/edit/(?P<popup>popup)?$",
|
|
|
|
FileEditView.as_view(),
|
|
|
|
name="file_edit",
|
|
|
|
),
|
2019-10-05 16:14:41 +00:00
|
|
|
re_path(
|
2018-10-04 19:29:19 +00:00
|
|
|
r"^file/(?P<file_id>[0-9]+)/prop/(?P<popup>popup)?$",
|
|
|
|
FileEditPropView.as_view(),
|
|
|
|
name="file_prop",
|
|
|
|
),
|
2019-10-05 16:14:41 +00:00
|
|
|
re_path(
|
2018-10-04 19:29:19 +00:00
|
|
|
r"^file/(?P<file_id>[0-9]+)/delete/(?P<popup>popup)?$",
|
|
|
|
FileDeleteView.as_view(),
|
|
|
|
name="file_delete",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path("file/moderation/", FileModerationView.as_view(), name="file_moderation"),
|
|
|
|
path(
|
|
|
|
"file/<int:file_id>/moderate/",
|
2018-10-04 19:29:19 +00:00
|
|
|
FileModerateView.as_view(),
|
|
|
|
name="file_moderate",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path("file/<int:file_id>/download/", send_file, name="download"),
|
2015-12-08 16:22:50 +00:00
|
|
|
# Page views
|
2023-01-09 21:07:03 +00:00
|
|
|
path("page/", PageListView.as_view(), name="page_list"),
|
|
|
|
path("page/create/", PageCreateView.as_view(), name="page_new"),
|
|
|
|
path(
|
|
|
|
"page/<int:page_id>/delete/",
|
2018-10-04 19:29:19 +00:00
|
|
|
PageDeleteView.as_view(),
|
|
|
|
name="page_delete",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"page/<path:page_name>/edit/",
|
2018-10-04 19:29:19 +00:00
|
|
|
PageEditView.as_view(),
|
|
|
|
name="page_edit",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"page/<path:page_name>/prop/",
|
2018-10-04 19:29:19 +00:00
|
|
|
PagePropView.as_view(),
|
|
|
|
name="page_prop",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"page/<path:page_name>/hist/",
|
2018-10-04 19:29:19 +00:00
|
|
|
PageHistView.as_view(),
|
|
|
|
name="page_hist",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"page/<path:page_name>/rev/<int:rev>/",
|
2018-10-04 19:29:19 +00:00
|
|
|
PageRevView.as_view(),
|
|
|
|
name="page_rev",
|
|
|
|
),
|
2023-01-09 21:07:03 +00:00
|
|
|
path(
|
|
|
|
"page/<path:page_name>/",
|
2018-10-04 19:29:19 +00:00
|
|
|
PageView.as_view(),
|
|
|
|
name="page",
|
|
|
|
),
|
2015-11-18 08:44:06 +00:00
|
|
|
]
|