upgrade re_path to path (#533)

This commit is contained in:
thomas girod 2023-01-09 22:07:03 +01:00 committed by GitHub
parent 37216cd16b
commit 99827e005b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 528 additions and 536 deletions

View File

@ -22,133 +22,127 @@
# #
# #
from django.urls import re_path from django.urls import path
from accounting.views import * from accounting.views import *
urlpatterns = [ urlpatterns = [
# Accounting types # Accounting types
re_path( path(
r"^simple_type$", "simple_type/",
SimplifiedAccountingTypeListView.as_view(), SimplifiedAccountingTypeListView.as_view(),
name="simple_type_list", name="simple_type_list",
), ),
re_path( path(
r"^simple_type/create$", "simple_type/create/",
SimplifiedAccountingTypeCreateView.as_view(), SimplifiedAccountingTypeCreateView.as_view(),
name="simple_type_new", name="simple_type_new",
), ),
re_path( path(
r"^simple_type/(?P<type_id>[0-9]+)/edit$", "simple_type/<int:type_id>/edit/",
SimplifiedAccountingTypeEditView.as_view(), SimplifiedAccountingTypeEditView.as_view(),
name="simple_type_edit", name="simple_type_edit",
), ),
# Accounting types # Accounting types
re_path(r"^type$", AccountingTypeListView.as_view(), name="type_list"), path("type/", AccountingTypeListView.as_view(), name="type_list"),
re_path(r"^type/create$", AccountingTypeCreateView.as_view(), name="type_new"), path("type/create/", AccountingTypeCreateView.as_view(), name="type_new"),
re_path( path(
r"^type/(?P<type_id>[0-9]+)/edit$", "type/<int:type_id>/edit/",
AccountingTypeEditView.as_view(), AccountingTypeEditView.as_view(),
name="type_edit", name="type_edit",
), ),
# Bank accounts # Bank accounts
re_path(r"^$", BankAccountListView.as_view(), name="bank_list"), path("", BankAccountListView.as_view(), name="bank_list"),
re_path(r"^bank/create$", BankAccountCreateView.as_view(), name="bank_new"), path("bank/create", BankAccountCreateView.as_view(), name="bank_new"),
re_path( path(
r"^bank/(?P<b_account_id>[0-9]+)$", "bank/<int:b_account_id>/",
BankAccountDetailView.as_view(), BankAccountDetailView.as_view(),
name="bank_details", name="bank_details",
), ),
re_path( path(
r"^bank/(?P<b_account_id>[0-9]+)/edit$", "bank/<int:b_account_id>/edit/",
BankAccountEditView.as_view(), BankAccountEditView.as_view(),
name="bank_edit", name="bank_edit",
), ),
re_path( path(
r"^bank/(?P<b_account_id>[0-9]+)/delete$", "bank/<int:b_account_id>/delete/",
BankAccountDeleteView.as_view(), BankAccountDeleteView.as_view(),
name="bank_delete", name="bank_delete",
), ),
# Club accounts # Club accounts
re_path(r"^club/create$", ClubAccountCreateView.as_view(), name="club_new"), path("club/create/", ClubAccountCreateView.as_view(), name="club_new"),
re_path( path(
r"^club/(?P<c_account_id>[0-9]+)$", "club/<int:c_account_id>/",
ClubAccountDetailView.as_view(), ClubAccountDetailView.as_view(),
name="club_details", name="club_details",
), ),
re_path( path(
r"^club/(?P<c_account_id>[0-9]+)/edit$", "club/<int:c_account_id>/edit/",
ClubAccountEditView.as_view(), ClubAccountEditView.as_view(),
name="club_edit", name="club_edit",
), ),
re_path( path(
r"^club/(?P<c_account_id>[0-9]+)/delete$", "club/<int:c_account_id>/delete/",
ClubAccountDeleteView.as_view(), ClubAccountDeleteView.as_view(),
name="club_delete", name="club_delete",
), ),
# Journals # Journals
re_path(r"^journal/create$", JournalCreateView.as_view(), name="journal_new"), path("journal/create/", JournalCreateView.as_view(), name="journal_new"),
re_path( path(
r"^journal/(?P<j_id>[0-9]+)$", "journal/<int:j_id>/",
JournalDetailView.as_view(), JournalDetailView.as_view(),
name="journal_details", name="journal_details",
), ),
re_path( path(
r"^journal/(?P<j_id>[0-9]+)/edit$", "journal/<int:j_id>/edit/",
JournalEditView.as_view(), JournalEditView.as_view(),
name="journal_edit", name="journal_edit",
), ),
re_path( path(
r"^journal/(?P<j_id>[0-9]+)/delete$", "journal/<int:j_id>/delete/",
JournalDeleteView.as_view(), JournalDeleteView.as_view(),
name="journal_delete", name="journal_delete",
), ),
re_path( path(
r"^journal/(?P<j_id>[0-9]+)/statement/nature$", "journal/<int:j_id>/statement/nature/",
JournalNatureStatementView.as_view(), JournalNatureStatementView.as_view(),
name="journal_nature_statement", name="journal_nature_statement",
), ),
re_path( path(
r"^journal/(?P<j_id>[0-9]+)/statement/person$", "journal/<int:j_id>/statement/person/",
JournalPersonStatementView.as_view(), JournalPersonStatementView.as_view(),
name="journal_person_statement", name="journal_person_statement",
), ),
re_path( path(
r"^journal/(?P<j_id>[0-9]+)/statement/accounting$", "journal/<int:j_id>/statement/accounting/",
JournalAccountingStatementView.as_view(), JournalAccountingStatementView.as_view(),
name="journal_accounting_statement", name="journal_accounting_statement",
), ),
# Operations # Operations
re_path( path(
r"^operation/create/(?P<j_id>[0-9]+)$", "operation/create/<int:j_id>/",
OperationCreateView.as_view(), OperationCreateView.as_view(),
name="op_new", name="op_new",
), ),
re_path( path("operation/<int:op_id>/", OperationEditView.as_view(), name="op_edit"),
r"^operation/(?P<op_id>[0-9]+)$", OperationEditView.as_view(), name="op_edit" path("operation/<int:op_id>/pdf/", OperationPDFView.as_view(), name="op_pdf"),
),
re_path(
r"^operation/(?P<op_id>[0-9]+)/pdf$", OperationPDFView.as_view(), name="op_pdf"
),
# Companies # Companies
re_path(r"^company/list$", CompanyListView.as_view(), name="co_list"), path("company/list/", CompanyListView.as_view(), name="co_list"),
re_path(r"^company/create$", CompanyCreateView.as_view(), name="co_new"), path("company/create/", CompanyCreateView.as_view(), name="co_new"),
re_path(r"^company/(?P<co_id>[0-9]+)$", CompanyEditView.as_view(), name="co_edit"), path("company/<int:co_id>/", CompanyEditView.as_view(), name="co_edit"),
# Labels # Labels
re_path(r"^label/new$", LabelCreateView.as_view(), name="label_new"), path("label/new/", LabelCreateView.as_view(), name="label_new"),
re_path( path(
r"^label/(?P<clubaccount_id>[0-9]+)$", "label/<int:clubaccount_id>/",
LabelListView.as_view(), LabelListView.as_view(),
name="label_list", name="label_list",
), ),
re_path( path("label/<int:label_id>/edit/", LabelEditView.as_view(), name="label_edit"),
r"^label/(?P<label_id>[0-9]+)/edit$", LabelEditView.as_view(), name="label_edit" path(
), "label/<int:label_id>/delete/",
re_path(
r"^label/(?P<label_id>[0-9]+)/delete$",
LabelDeleteView.as_view(), LabelDeleteView.as_view(),
name="label_delete", name="label_delete",
), ),
# User account # User account
re_path(r"^refound/account$", RefoundAccountView.as_view(), name="refound_account"), path("refound/account/", RefoundAccountView.as_view(), name="refound_account"),
] ]

View File

@ -23,94 +23,84 @@
# #
# #
from django.urls import re_path from django.urls import path
from club.views import * from club.views import *
urlpatterns = [ urlpatterns = [
re_path(r"^$", ClubListView.as_view(), name="club_list"), path("", ClubListView.as_view(), name="club_list"),
re_path(r"^new$", ClubCreateView.as_view(), name="club_new"), path("new/", ClubCreateView.as_view(), name="club_new"),
re_path(r"^stats$", ClubStatView.as_view(), name="club_stats"), path("stats/", ClubStatView.as_view(), name="club_stats"),
re_path(r"^(?P<club_id>[0-9]+)/$", ClubView.as_view(), name="club_view"), path("<int:club_id>/", ClubView.as_view(), name="club_view"),
re_path( path(
r"^(?P<club_id>[0-9]+)/rev/(?P<rev_id>[0-9]+)/$", "<int:club_id>/rev/<int:rev_id>/",
ClubRevView.as_view(), ClubRevView.as_view(),
name="club_view_rev", name="club_view_rev",
), ),
re_path( path("<int:club_id>/hist/", ClubPageHistView.as_view(), name="club_hist"),
r"^(?P<club_id>[0-9]+)/hist$", ClubPageHistView.as_view(), name="club_hist" path("<int:club_id>/edit/", ClubEditView.as_view(), name="club_edit"),
), path(
re_path(r"^(?P<club_id>[0-9]+)/edit$", ClubEditView.as_view(), name="club_edit"), "<int:club_id>/edit/page/",
re_path(
r"^(?P<club_id>[0-9]+)/edit/page$",
ClubPageEditView.as_view(), ClubPageEditView.as_view(),
name="club_edit_page", name="club_edit_page",
), ),
re_path( path("<int:club_id>/members/", ClubMembersView.as_view(), name="club_members"),
r"^(?P<club_id>[0-9]+)/members$", ClubMembersView.as_view(), name="club_members" path(
), "<int:club_id>/elderlies/",
re_path(
r"^(?P<club_id>[0-9]+)/elderlies$",
ClubOldMembersView.as_view(), ClubOldMembersView.as_view(),
name="club_old_members", name="club_old_members",
), ),
re_path( path(
r"^(?P<club_id>[0-9]+)/sellings$", "<int:club_id>/sellings/",
ClubSellingView.as_view(), ClubSellingView.as_view(),
name="club_sellings", name="club_sellings",
), ),
re_path( path(
r"^(?P<club_id>[0-9]+)/sellings/csv$", "<int:club_id>/sellings/csv/",
ClubSellingCSVView.as_view(), ClubSellingCSVView.as_view(),
name="sellings_csv", name="sellings_csv",
), ),
re_path( path("<int:club_id>/prop/", ClubEditPropView.as_view(), name="club_prop"),
r"^(?P<club_id>[0-9]+)/prop$", ClubEditPropView.as_view(), name="club_prop" path("<int:club_id>/tools/", ClubToolsView.as_view(), name="tools"),
), path("<int:club_id>/mailing/", ClubMailingView.as_view(), name="mailing"),
re_path(r"^(?P<club_id>[0-9]+)/tools$", ClubToolsView.as_view(), name="tools"), path(
re_path( "<int:mailing_id>/mailing/generate/",
r"^(?P<club_id>[0-9]+)/mailing$", ClubMailingView.as_view(), name="mailing"
),
re_path(
r"^(?P<mailing_id>[0-9]+)/mailing/generate$",
MailingAutoGenerationView.as_view(), MailingAutoGenerationView.as_view(),
name="mailing_generate", name="mailing_generate",
), ),
re_path( path(
r"^(?P<mailing_id>[0-9]+)/mailing/delete$", "<int:mailing_id>/mailing/delete/",
MailingDeleteView.as_view(), MailingDeleteView.as_view(),
name="mailing_delete", name="mailing_delete",
), ),
re_path( path(
r"^(?P<mailing_subscription_id>[0-9]+)/mailing/delete/subscription$", "<int:mailing_subscription_id>/mailing/delete/subscription/",
MailingSubscriptionDeleteView.as_view(), MailingSubscriptionDeleteView.as_view(),
name="mailing_subscription_delete", name="mailing_subscription_delete",
), ),
re_path( path(
r"^membership/(?P<membership_id>[0-9]+)/set_old$", "membership/<int:membership_id>/set_old/",
MembershipSetOldView.as_view(), MembershipSetOldView.as_view(),
name="membership_set_old", name="membership_set_old",
), ),
re_path( path(
r"^membership/(?P<membership_id>[0-9]+)/delete$", "membership/<int:membership_id>/delete/",
MembershipDeleteView.as_view(), MembershipDeleteView.as_view(),
name="membership_delete", name="membership_delete",
), ),
re_path( path("<int:club_id>/poster/", PosterListView.as_view(), name="poster_list"),
r"^(?P<club_id>[0-9]+)/poster$", PosterListView.as_view(), name="poster_list" path(
), "<int:club_id>/poster/create/",
re_path(
r"^(?P<club_id>[0-9]+)/poster/create$",
PosterCreateView.as_view(), PosterCreateView.as_view(),
name="poster_create", name="poster_create",
), ),
re_path( path(
r"^(?P<club_id>[0-9]+)/poster/(?P<poster_id>[0-9]+)/edit$", "<int:club_id>/poster/<int:poster_id>/edit/",
PosterEditView.as_view(), PosterEditView.as_view(),
name="poster_edit", name="poster_edit",
), ),
re_path( path(
r"^(?P<club_id>[0-9]+)/poster/(?P<poster_id>[0-9]+)/delete$", "<int:club_id>/poster/<int:poster_id>/delete/",
PosterDeleteView.as_view(), PosterDeleteView.as_view(),
name="poster_delete", name="poster_delete",
), ),

View File

@ -22,104 +22,98 @@
# #
# #
from django.urls import re_path from django.urls import path
from com.views import *
from club.views import MailingDeleteView from club.views import MailingDeleteView
from com.views import *
urlpatterns = [ urlpatterns = [
re_path(r"^sith/edit/alert$", AlertMsgEditView.as_view(), name="alert_edit"), path("sith/edit/alert/", AlertMsgEditView.as_view(), name="alert_edit"),
re_path(r"^sith/edit/info$", InfoMsgEditView.as_view(), name="info_edit"), path("sith/edit/info/", InfoMsgEditView.as_view(), name="info_edit"),
re_path( path(
r"^sith/edit/weekmail_destinations$", "sith/edit/weekmail_destinations/",
WeekmailDestinationEditView.as_view(), WeekmailDestinationEditView.as_view(),
name="weekmail_destinations", name="weekmail_destinations",
), ),
re_path(r"^weekmail$", WeekmailEditView.as_view(), name="weekmail"), path("weekmail/", WeekmailEditView.as_view(), name="weekmail"),
re_path( path("weekmail/preview/", WeekmailPreviewView.as_view(), name="weekmail_preview"),
r"^weekmail/preview$", WeekmailPreviewView.as_view(), name="weekmail_preview" path(
), "weekmail/new_article/",
re_path(
r"^weekmail/new_article$",
WeekmailArticleCreateView.as_view(), WeekmailArticleCreateView.as_view(),
name="weekmail_article", name="weekmail_article",
), ),
re_path( path(
r"^weekmail/article/(?P<article_id>[0-9]+)/delete$", "weekmail/article/<int:article_id>/delete/",
WeekmailArticleDeleteView.as_view(), WeekmailArticleDeleteView.as_view(),
name="weekmail_article_delete", name="weekmail_article_delete",
), ),
re_path( path(
r"^weekmail/article/(?P<article_id>[0-9]+)/edit$", "weekmail/article/<int:article_id>/edit/",
WeekmailArticleEditView.as_view(), WeekmailArticleEditView.as_view(),
name="weekmail_article_edit", name="weekmail_article_edit",
), ),
re_path(r"^news$", NewsListView.as_view(), name="news_list"), path("news/", NewsListView.as_view(), name="news_list"),
re_path(r"^news/admin$", NewsAdminListView.as_view(), name="news_admin_list"), path("news/admin/", NewsAdminListView.as_view(), name="news_admin_list"),
re_path(r"^news/create$", NewsCreateView.as_view(), name="news_new"), path("news/create/", NewsCreateView.as_view(), name="news_new"),
re_path( path(
r"^news/(?P<news_id>[0-9]+)/delete$", "news/<int:news_id>/delete/",
NewsDeleteView.as_view(), NewsDeleteView.as_view(),
name="news_delete", name="news_delete",
), ),
re_path( path(
r"^news/(?P<news_id>[0-9]+)/moderate$", "news/<int:news_id>/moderate/",
NewsModerateView.as_view(), NewsModerateView.as_view(),
name="news_moderate", name="news_moderate",
), ),
re_path( path("news/<int:news_id>/edit/", NewsEditView.as_view(), name="news_edit"),
r"^news/(?P<news_id>[0-9]+)/edit$", NewsEditView.as_view(), name="news_edit" path("news/<int:news_id>/", NewsDetailView.as_view(), name="news_detail"),
), path("mailings/", MailingListAdminView.as_view(), name="mailing_admin"),
re_path( path(
r"^news/(?P<news_id>[0-9]+)$", NewsDetailView.as_view(), name="news_detail" "mailings/<int:mailing_id>/moderate/",
),
re_path(r"^mailings$", MailingListAdminView.as_view(), name="mailing_admin"),
re_path(
r"^mailings/(?P<mailing_id>[0-9]+)/moderate$",
MailingModerateView.as_view(), MailingModerateView.as_view(),
name="mailing_moderate", name="mailing_moderate",
), ),
re_path( path(
r"^mailings/(?P<mailing_id>[0-9]+)/delete$", "mailings/<int:mailing_id>/delete/",
MailingDeleteView.as_view(redirect_page="com:mailing_admin"), MailingDeleteView.as_view(redirect_page="com:mailing_admin"),
name="mailing_delete", name="mailing_delete",
), ),
re_path(r"^poster$", PosterListView.as_view(), name="poster_list"), path("poster/", PosterListView.as_view(), name="poster_list"),
re_path(r"^poster/create$", PosterCreateView.as_view(), name="poster_create"), path("poster/create/", PosterCreateView.as_view(), name="poster_create"),
re_path( path(
r"^poster/(?P<poster_id>[0-9]+)/edit$", "poster/<int:poster_id>/edit/",
PosterEditView.as_view(), PosterEditView.as_view(),
name="poster_edit", name="poster_edit",
), ),
re_path( path(
r"^poster/(?P<poster_id>[0-9]+)/delete$", "poster/<int:poster_id>/delete/",
PosterDeleteView.as_view(), PosterDeleteView.as_view(),
name="poster_delete", name="poster_delete",
), ),
re_path( path(
r"^poster/moderate$", "poster/moderate/",
PosterModerateListView.as_view(), PosterModerateListView.as_view(),
name="poster_moderate_list", name="poster_moderate_list",
), ),
re_path( path(
r"^poster/(?P<object_id>[0-9]+)/moderate$", "poster/<int:object_id>/moderate/",
PosterModerateView.as_view(), PosterModerateView.as_view(),
name="poster_moderate", name="poster_moderate",
), ),
re_path(r"^screen$", ScreenListView.as_view(), name="screen_list"), path("screen/", ScreenListView.as_view(), name="screen_list"),
re_path(r"^screen/create$", ScreenCreateView.as_view(), name="screen_create"), path("screen/create/", ScreenCreateView.as_view(), name="screen_create"),
re_path( path(
r"^screen/(?P<screen_id>[0-9]+)/slideshow$", "screen/<int:screen_id>/slideshow/",
ScreenSlideshowView.as_view(), ScreenSlideshowView.as_view(),
name="screen_slideshow", name="screen_slideshow",
), ),
re_path( path(
r"^screen/(?P<screen_id>[0-9]+)/edit$", "screen/<int:screen_id>/edit/",
ScreenEditView.as_view(), ScreenEditView.as_view(),
name="screen_edit", name="screen_edit",
), ),
re_path( path(
r"^screen/(?P<screen_id>[0-9]+)/delete$", "screen/<int:screen_id>/delete/",
ScreenDeleteView.as_view(), ScreenDeleteView.as_view(),
name="screen_delete", name="screen_delete",
), ),

35
core/converters.py Normal file
View File

@ -0,0 +1,35 @@
from core.models import Page
class FourDigitYearConverter:
regex = "[0-9]{4}"
def to_python(self, value):
return int(value)
def to_url(self, value):
return str(value).zfill(4)
class TwoDigitMonthConverter:
regex = "[0-9]{2}"
def to_python(self, value):
return int(value)
def to_url(self, value):
return str(value).zfill(2)
class BooleanStringConverter:
"""
Converter whose regex match either True or False
"""
regex = r"(True)|(False)"
def to_python(self, value):
return str(value) == "True"
def to_url(self, value):
return str(value)

View File

@ -290,8 +290,7 @@ class MarkdownTest(TestCase):
class PageHandlingTest(TestCase): class PageHandlingTest(TestCase):
def setUp(self): def setUp(self):
try: self.root_group = Group.objects.create(name="root")
Group.objects.create(name="root")
u = User( u = User(
username="root", username="root",
last_name="", last_name="",
@ -304,19 +303,27 @@ class PageHandlingTest(TestCase):
u.set_password("plop") u.set_password("plop")
u.save() u.save()
self.client.login(username="root", password="plop") self.client.login(username="root", password="plop")
except Exception as e:
print(e)
def test_create_page_ok(self): def test_create_page_ok(self):
""" """
Should create a page correctly Should create a page correctly
""" """
self.client.post(
reverse("core:page_new"), {"parent": "", "name": "guy", "owner_group": 1} response = self.client.post(
reverse("core:page_new"),
{"parent": "", "name": "guy", "owner_group": self.root_group.id},
) )
self.assertRedirects(
response, reverse("core:page", kwargs={"page_name": "guy"})
)
self.assertTrue(Page.objects.filter(name="guy").exists())
response = self.client.get(reverse("core:page", kwargs={"page_name": "guy"})) response = self.client.get(reverse("core:page", kwargs={"page_name": "guy"}))
self.assertTrue(response.status_code == 200) self.assertEqual(response.status_code, 200)
self.assertTrue('<a href="/page/guy/hist">' in str(response.content)) html = response.content.decode()
self.assertIn('<a href="/page/guy/hist/">', html)
self.assertIn('<a href="/page/guy/edit/">', html)
self.assertIn('<a href="/page/guy/prop/">', html)
def test_create_child_page_ok(self): def test_create_child_page_ok(self):
""" """
@ -339,29 +346,25 @@ class PageHandlingTest(TestCase):
""" """
Should display a page correctly Should display a page correctly
""" """
parent = Page(name="guy", owner_group=Group.objects.filter(id=1).first()) parent = Page(name="guy", owner_group=self.root_group)
parent.save(force_lock=True) parent.save(force_lock=True)
page = Page( page = Page(name="bibou", owner_group=self.root_group, parent=parent)
name="bibou", owner_group=Group.objects.filter(id=1).first(), parent=parent
)
page.save(force_lock=True) page.save(force_lock=True)
response = self.client.get( response = self.client.get(
reverse("core:page", kwargs={"page_name": "guy/bibou"}) reverse("core:page", kwargs={"page_name": "guy/bibou"})
) )
self.assertTrue(response.status_code == 200) self.assertTrue(response.status_code == 200)
self.assertTrue( html = response.content.decode()
'<a href="/page/guy/bibou/edit">\\xc3\\x89diter</a>' self.assertIn('<a href="/page/guy/bibou/edit/">', html)
in str(response.content)
)
def test_access_page_not_found(self): def test_access_page_not_found(self):
""" """
Should not display a page correctly Should not display a page correctly
""" """
response = self.client.get(reverse("core:page", kwargs={"page_name": "swagg"})) response = self.client.get(reverse("core:page", kwargs={"page_name": "swagg"}))
response = self.client.get("/page/swagg/")
self.assertTrue(response.status_code == 200) self.assertTrue(response.status_code == 200)
self.assertTrue('<a href="/page/create?page=swagg">' in str(response.content)) html = response.content.decode()
self.assertIn('<a href="/page/create/?page=swagg">', html)
def test_create_page_markdown_safe(self): def test_create_page_markdown_safe(self):
""" """

View File

@ -23,40 +23,46 @@
# #
# #
from django.urls import re_path, path from django.urls import path, re_path, register_converter
from core.views import * from core.views import *
from core.converters import (
FourDigitYearConverter,
TwoDigitMonthConverter,
BooleanStringConverter,
)
register_converter(FourDigitYearConverter, "yyyy")
register_converter(TwoDigitMonthConverter, "mm")
register_converter(BooleanStringConverter, "bool")
urlpatterns = [ urlpatterns = [
re_path(r"^$", index, name="index"), path("", index, name="index"),
re_path(r"^to_markdown$", ToMarkdownView.as_view(), name="to_markdown"), path("to_markdown/", ToMarkdownView.as_view(), name="to_markdown"),
re_path(r"^notifications$", NotificationList.as_view(), name="notification_list"), path("notifications/", NotificationList.as_view(), name="notification_list"),
re_path(r"^notification/(?P<notif_id>[0-9]+)$", notification, name="notification"), path("notification/<int:notif_id>/", notification, name="notification"),
# Search # Search
re_path(r"^search/$", search_view, name="search"), path("search/", search_view, name="search"),
re_path(r"^search_json/$", search_json, name="search_json"), path("search_json/", search_json, name="search_json"),
re_path(r"^search_user/$", search_user_json, name="search_user"), path("search_user/", search_user_json, name="search_user"),
# Login and co # Login and co
re_path(r"^login/$", SithLoginView.as_view(), name="login"), path("login/", SithLoginView.as_view(), name="login"),
re_path(r"^logout/$", logout, name="logout"), path("logout/", logout, name="logout"),
re_path( path("password_change/", SithPasswordChangeView.as_view(), name="password_change"),
r"^password_change/$", SithPasswordChangeView.as_view(), name="password_change" path(
), "password_change/<int:user_id>/",
re_path(
r"^password_change/(?P<user_id>[0-9]+)$",
password_root_change, password_root_change,
name="password_root_change", name="password_root_change",
), ),
re_path( path(
r"^password_change/done$", "password_change/done/",
SithPasswordChangeDoneView.as_view(), SithPasswordChangeDoneView.as_view(),
name="password_change_done", name="password_change_done",
), ),
re_path( path("password_reset/", SithPasswordResetView.as_view(), name="password_reset"),
r"^password_reset/$", SithPasswordResetView.as_view(), name="password_reset" path(
), "password_reset/done/",
re_path(
r"^password_reset/done$",
SithPasswordResetDoneView.as_view(), SithPasswordResetDoneView.as_view(),
name="password_reset_done", name="password_reset_done",
), ),
@ -65,110 +71,103 @@ urlpatterns = [
SithPasswordResetConfirmView.as_view(), SithPasswordResetConfirmView.as_view(),
name="password_reset_confirm", name="password_reset_confirm",
), ),
re_path( path(
r"^reset/done/$", "reset/done/",
SithPasswordResetCompleteView.as_view(), SithPasswordResetCompleteView.as_view(),
name="password_reset_complete", name="password_reset_complete",
), ),
re_path(r"^register$", register, name="register"), path("register/", register, name="register"),
# Group handling # Group handling
re_path(r"^group/$", GroupListView.as_view(), name="group_list"), path("group/", GroupListView.as_view(), name="group_list"),
re_path(r"^group/new/$", GroupCreateView.as_view(), name="group_new"), path("group/new/", GroupCreateView.as_view(), name="group_new"),
re_path( path("group/<int:group_id>/", GroupEditView.as_view(), name="group_edit"),
r"^group/(?P<group_id>[0-9]+)/$", GroupEditView.as_view(), name="group_edit" path(
), "group/<int:group_id>/delete/",
re_path(
r"^group/(?P<group_id>[0-9]+)/delete$",
GroupDeleteView.as_view(), GroupDeleteView.as_view(),
name="group_delete", name="group_delete",
), ),
re_path( path(
r"^group/(?P<group_id>[0-9]+)/detail$", "group/<int:group_id>/detail/",
GroupTemplateView.as_view(), GroupTemplateView.as_view(),
name="group_detail", name="group_detail",
), ),
# User views # User views
re_path(r"^user/$", UserListView.as_view(), name="user_list"), path("user/", UserListView.as_view(), name="user_list"),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/mini$", "user/<int:user_id>/mini/",
UserMiniView.as_view(), UserMiniView.as_view(),
name="user_profile_mini", name="user_profile_mini",
), ),
re_path(r"^user/(?P<user_id>[0-9]+)/$", UserView.as_view(), name="user_profile"), path("user/<int:user_id>/", UserView.as_view(), name="user_profile"),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/pictures$", "user/<int:user_id>/pictures/",
UserPicturesView.as_view(), UserPicturesView.as_view(),
name="user_pictures", name="user_pictures",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/godfathers$", "user/<int:user_id>/godfathers/",
UserGodfathersView.as_view(), UserGodfathersView.as_view(),
name="user_godfathers", name="user_godfathers",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/godfathers/tree$", "user/<int:user_id>/godfathers/tree/",
UserGodfathersTreeView.as_view(), UserGodfathersTreeView.as_view(),
name="user_godfathers_tree", name="user_godfathers_tree",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/godfathers/tree/pict$", "user/<int:user_id>/godfathers/tree/pict/",
UserGodfathersTreePictureView.as_view(), UserGodfathersTreePictureView.as_view(),
name="user_godfathers_tree_pict", name="user_godfathers_tree_pict",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/godfathers/(?P<godfather_id>[0-9]+)/(?P<is_father>(True)|(False))/delete$", "user/<int:user_id>/godfathers/<int:godfather_id>/<bool:is_father>/delete/",
DeleteUserGodfathers, delete_user_godfather,
name="user_godfathers_delete", name="user_godfathers_delete",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/edit$", "user/<int:user_id>/edit/",
UserUpdateProfileView.as_view(), UserUpdateProfileView.as_view(),
name="user_edit", name="user_edit",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/profile_upload$", "user/<int:user_id>/profile_upload/",
UserUploadProfilePictView.as_view(), UserUploadProfilePictView.as_view(),
name="user_profile_upload", name="user_profile_upload",
), ),
re_path( path("user/<int:user_id>/clubs/", UserClubView.as_view(), name="user_clubs"),
r"^user/(?P<user_id>[0-9]+)/clubs$", UserClubView.as_view(), name="user_clubs" path(
), "user/<int:user_id>/prefs/",
re_path(
r"^user/(?P<user_id>[0-9]+)/prefs$",
UserPreferencesView.as_view(), UserPreferencesView.as_view(),
name="user_prefs", name="user_prefs",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/groups$", "user/<int:user_id>/groups/",
UserUpdateGroupView.as_view(), UserUpdateGroupView.as_view(),
name="user_groups", name="user_groups",
), ),
re_path(r"^user/tools/$", UserToolsView.as_view(), name="user_tools"), path("user/tools/", UserToolsView.as_view(), name="user_tools"),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/account$", "user/<int:user_id>/account/",
UserAccountView.as_view(), UserAccountView.as_view(),
name="user_account", name="user_account",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/account/(?P<year>[0-9]+)/(?P<month>[0-9]+)$", "user/<int:user_id>/account/<yyyy:year>/<mm:month>/",
UserAccountDetailView.as_view(), UserAccountDetailView.as_view(),
name="user_account_detail", name="user_account_detail",
), ),
re_path( path("user/<int:user_id>/stats/", UserStatsView.as_view(), name="user_stats"),
r"^user/(?P<user_id>[0-9]+)/stats$", UserStatsView.as_view(), name="user_stats" path(
), "user/<int:user_id>/gift/create/",
re_path(
r"^user/(?P<user_id>[0-9]+)/gift/create$",
GiftCreateView.as_view(), GiftCreateView.as_view(),
name="user_gift_create", name="user_gift_create",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/gift/delete/(?P<gift_id>[0-9]+)/$", "user/<int:user_id>/gift/delete/<int:gift_id>/",
GiftDeleteView.as_view(), GiftDeleteView.as_view(),
name="user_gift_delete", name="user_gift_delete",
), ),
# File views # File views
# re_path(r'^file/add/(?P<popup>popup)?$', FileCreateView.as_view(), name='file_new'),
re_path(r"^file/(?P<popup>popup)?$", FileListView.as_view(), name="file_list"), re_path(r"^file/(?P<popup>popup)?$", FileListView.as_view(), name="file_list"),
re_path( re_path(
r"^file/(?P<file_id>[0-9]+)/(?P<popup>popup)?$", r"^file/(?P<file_id>[0-9]+)/(?P<popup>popup)?$",
@ -190,43 +189,43 @@ urlpatterns = [
FileDeleteView.as_view(), FileDeleteView.as_view(),
name="file_delete", name="file_delete",
), ),
re_path(r"^file/moderation$", FileModerationView.as_view(), name="file_moderation"), path("file/moderation/", FileModerationView.as_view(), name="file_moderation"),
re_path( path(
r"^file/(?P<file_id>[0-9]+)/moderate$", "file/<int:file_id>/moderate/",
FileModerateView.as_view(), FileModerateView.as_view(),
name="file_moderate", name="file_moderate",
), ),
re_path(r"^file/(?P<file_id>[0-9]+)/download$", send_file, name="download"), path("file/<int:file_id>/download/", send_file, name="download"),
# Page views # Page views
re_path(r"^page/$", PageListView.as_view(), name="page_list"), path("page/", PageListView.as_view(), name="page_list"),
re_path(r"^page/create$", PageCreateView.as_view(), name="page_new"), path("page/create/", PageCreateView.as_view(), name="page_new"),
re_path( path(
r"^page/(?P<page_id>[0-9]*)/delete$", "page/<int:page_id>/delete/",
PageDeleteView.as_view(), PageDeleteView.as_view(),
name="page_delete", name="page_delete",
), ),
re_path( path(
r"^page/(?P<page_name>([/a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])+)/edit$", "page/<path:page_name>/edit/",
PageEditView.as_view(), PageEditView.as_view(),
name="page_edit", name="page_edit",
), ),
re_path( path(
r"^page/(?P<page_name>([/a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])+)/prop$", "page/<path:page_name>/prop/",
PagePropView.as_view(), PagePropView.as_view(),
name="page_prop", name="page_prop",
), ),
re_path( path(
r"^page/(?P<page_name>([/a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])+)/hist$", "page/<path:page_name>/hist/",
PageHistView.as_view(), PageHistView.as_view(),
name="page_hist", name="page_hist",
), ),
re_path( path(
r"^page/(?P<page_name>([/a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])+)/rev/(?P<rev>[0-9]+)/", "page/<path:page_name>/rev/<int:rev>/",
PageRevView.as_view(), PageRevView.as_view(),
name="page_rev", name="page_rev",
), ),
re_path( path(
r"^page/(?P<page_name>([/a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])+)/$", "page/<path:page_name>/",
PageView.as_view(), PageView.as_view(),
name="page", name="page",
), ),

View File

@ -338,16 +338,16 @@ class UserPicturesView(UserTabsMixin, CanViewMixin, DetailView):
return kwargs return kwargs
def DeleteUserGodfathers(request, user_id, godfather_id, is_father): def delete_user_godfather(request, user_id, godfather_id, is_father):
user = User.objects.get(id=user_id) user_is_admin = request.user.is_root or request.user.is_board_member
if (user == request.user) or request.user.is_root or request.user.is_board_member: if user_id != request.user.id and not user_is_admin:
ud = get_object_or_404(User, id=godfather_id) raise PermissionDenied()
if is_father == "True": user = get_object_or_404(User, id=user_id)
user.godfathers.remove(ud) to_remove = get_object_or_404(User, id=godfather_id)
if is_father:
user.godfathers.remove(to_remove)
else: else:
user.godchildren.remove(ud) user.godchildren.remove(to_remove)
else:
raise PermissionDenied
return redirect("core:user_godfathers", user_id=user_id) return redirect("core:user_godfathers", user_id=user_id)

View File

@ -22,47 +22,47 @@
# #
# #
from django.urls import re_path, path from django.urls import path
from counter.views import * from counter.views import *
urlpatterns = [ urlpatterns = [
re_path(r"^(?P<counter_id>[0-9]+)$", CounterMain.as_view(), name="details"), path("<int:counter_id>/", CounterMain.as_view(), name="details"),
re_path( path(
r"^(?P<counter_id>[0-9]+)/click/(?P<user_id>[0-9]+)$", "<int:counter_id>/click/<int:user_id>/",
CounterClick.as_view(), CounterClick.as_view(),
name="click", name="click",
), ),
re_path( path(
r"^(?P<counter_id>[0-9]+)/last_ops$", "<int:counter_id>/last_ops/",
CounterLastOperationsView.as_view(), CounterLastOperationsView.as_view(),
name="last_ops", name="last_ops",
), ),
re_path( path(
r"^(?P<counter_id>[0-9]+)/cash_summary$", "<int:counter_id>/cash_summary/",
CounterCashSummaryView.as_view(), CounterCashSummaryView.as_view(),
name="cash_summary", name="cash_summary",
), ),
re_path( path(
r"^(?P<counter_id>[0-9]+)/activity$", "<int:counter_id>/activity/",
CounterActivityView.as_view(), CounterActivityView.as_view(),
name="activity", name="activity",
), ),
re_path(r"^(?P<counter_id>[0-9]+)/stats$", CounterStatView.as_view(), name="stats"), path("<int:counter_id>/stats/", CounterStatView.as_view(), name="stats"),
re_path(r"^(?P<counter_id>[0-9]+)/login$", CounterLogin.as_view(), name="login"), path("<int:counter_id>/login/", CounterLogin.as_view(), name="login"),
re_path(r"^(?P<counter_id>[0-9]+)/logout$", CounterLogout.as_view(), name="logout"), path("<int:counter_id>/logout/", CounterLogout.as_view(), name="logout"),
re_path( path(
r"^eticket/(?P<selling_id>[0-9]+)/pdf$", "eticket/<int:selling_id>/pdf/",
EticketPDFView.as_view(), EticketPDFView.as_view(),
name="eticket_pdf", name="eticket_pdf",
), ),
re_path( path(
r"^customer/(?P<customer_id>[0-9]+)/card/add$", "customer/<int:customer_id>/card/add/",
StudentCardFormView.as_view(), StudentCardFormView.as_view(),
name="add_student_card", name="add_student_card",
), ),
re_path( path(
r"^customer/(?P<customer_id>[0-9]+)/card/delete/(?P<card_id>[0-9]+)/$", "customer/<int:customer_id>/card/delete/<int:card_id>/",
StudentCardDeleteView.as_view(), StudentCardDeleteView.as_view(),
name="delete_student_card", name="delete_student_card",
), ),
@ -76,76 +76,76 @@ urlpatterns = [
edit_billing_info, edit_billing_info,
name="edit_billing_info", name="edit_billing_info",
), ),
re_path(r"^admin/(?P<counter_id>[0-9]+)$", CounterEditView.as_view(), name="admin"), path("admin/<int:counter_id>/", CounterEditView.as_view(), name="admin"),
re_path( path(
r"^admin/(?P<counter_id>[0-9]+)/prop$", "admin/<int:counter_id>/prop/",
CounterEditPropView.as_view(), CounterEditPropView.as_view(),
name="prop_admin", name="prop_admin",
), ),
re_path(r"^admin$", CounterListView.as_view(), name="admin_list"), path("admin/", CounterListView.as_view(), name="admin_list"),
re_path(r"^admin/new$", CounterCreateView.as_view(), name="new"), path("admin/new/", CounterCreateView.as_view(), name="new"),
re_path( path(
r"^admin/delete/(?P<counter_id>[0-9]+)$", "admin/delete/<int:counter_id>/",
CounterDeleteView.as_view(), CounterDeleteView.as_view(),
name="delete", name="delete",
), ),
re_path(r"^admin/invoices_call$", InvoiceCallView.as_view(), name="invoices_call"), path("admin/invoices_call/", InvoiceCallView.as_view(), name="invoices_call"),
re_path( path(
r"^admin/cash_summary/list$", "admin/cash_summary/list/",
CashSummaryListView.as_view(), CashSummaryListView.as_view(),
name="cash_summary_list", name="cash_summary_list",
), ),
re_path( path(
r"^admin/cash_summary/(?P<cashsummary_id>[0-9]+)$", "admin/cash_summary/<int:cashsummary_id>/",
CashSummaryEditView.as_view(), CashSummaryEditView.as_view(),
name="cash_summary_edit", name="cash_summary_edit",
), ),
re_path(r"^admin/product/list$", ProductListView.as_view(), name="product_list"), path("admin/product/list/", ProductListView.as_view(), name="product_list"),
re_path( path(
r"^admin/product/list_archived$", "admin/product/list_archived/",
ProductArchivedListView.as_view(), ProductArchivedListView.as_view(),
name="product_list_archived", name="product_list_archived",
), ),
re_path(r"^admin/product/create$", ProductCreateView.as_view(), name="new_product"), path("admin/product/create/", ProductCreateView.as_view(), name="new_product"),
re_path( path(
r"^admin/product/(?P<product_id>[0-9]+)$", "admin/product/<int:product_id>/",
ProductEditView.as_view(), ProductEditView.as_view(),
name="product_edit", name="product_edit",
), ),
re_path( path(
r"^admin/producttype/list$", "admin/producttype/list/",
ProductTypeListView.as_view(), ProductTypeListView.as_view(),
name="producttype_list", name="producttype_list",
), ),
re_path( path(
r"^admin/producttype/create$", "admin/producttype/create/",
ProductTypeCreateView.as_view(), ProductTypeCreateView.as_view(),
name="new_producttype", name="new_producttype",
), ),
re_path( path(
r"^admin/producttype/(?P<type_id>[0-9]+)$", "admin/producttype/<int:type_id>/",
ProductTypeEditView.as_view(), ProductTypeEditView.as_view(),
name="producttype_edit", name="producttype_edit",
), ),
re_path(r"^admin/eticket/list$", EticketListView.as_view(), name="eticket_list"), path("admin/eticket/list/", EticketListView.as_view(), name="eticket_list"),
re_path(r"^admin/eticket/new$", EticketCreateView.as_view(), name="new_eticket"), path("admin/eticket/new/", EticketCreateView.as_view(), name="new_eticket"),
re_path( path(
r"^admin/eticket/(?P<eticket_id>[0-9]+)$", "admin/eticket/<int:eticket_id>/",
EticketEditView.as_view(), EticketEditView.as_view(),
name="edit_eticket", name="edit_eticket",
), ),
re_path( path(
r"^admin/selling/(?P<selling_id>[0-9]+)/delete$", "admin/selling/<int:selling_id>/delete/",
SellingDeleteView.as_view(), SellingDeleteView.as_view(),
name="selling_delete", name="selling_delete",
), ),
re_path( path(
r"^admin/refilling/(?P<refilling_id>[0-9]+)/delete$", "admin/refilling/<int:refilling_id>/delete/",
RefillingDeleteView.as_view(), RefillingDeleteView.as_view(),
name="refilling_delete", name="refilling_delete",
), ),
re_path( path(
r"^admin/(?P<counter_id>[0-9]+)/refillings$", "admin/<int:counter_id>/refillings/",
CounterRefillingListView.as_view(), CounterRefillingListView.as_view(),
name="refilling_list", name="refilling_list",
), ),

View File

@ -1,57 +1,49 @@
from django.urls import re_path from django.urls import path
from election.views import * from election.views import *
urlpatterns = [ urlpatterns = [
re_path(r"^$", ElectionsListView.as_view(), name="list"), path("", ElectionsListView.as_view(), name="list"),
re_path(r"^archived$", ElectionListArchivedView.as_view(), name="list_archived"), path("archived/", ElectionListArchivedView.as_view(), name="list_archived"),
re_path(r"^add$", ElectionCreateView.as_view(), name="create"), path("add/", ElectionCreateView.as_view(), name="create"),
re_path( path("<int:election_id>/edit/", ElectionUpdateView.as_view(), name="update"),
r"^(?P<election_id>[0-9]+)/edit$", ElectionUpdateView.as_view(), name="update" path("<int:election_id>/delete/", ElectionDeleteView.as_view(), name="delete"),
), path(
re_path( "<int:election_id>/list/add/",
r"^(?P<election_id>[0-9]+)/delete$", ElectionDeleteView.as_view(), name="delete"
),
re_path(
r"^(?P<election_id>[0-9]+)/list/add$",
ElectionListCreateView.as_view(), ElectionListCreateView.as_view(),
name="create_list", name="create_list",
), ),
re_path( path(
r"^(?P<list_id>[0-9]+)/list/delete$", "<int:list_id>/list/delete/",
ElectionListDeleteView.as_view(), ElectionListDeleteView.as_view(),
name="delete_list", name="delete_list",
), ),
re_path( path(
r"^(?P<election_id>[0-9]+)/role/create$", "<int:election_id>/role/create/",
RoleCreateView.as_view(), RoleCreateView.as_view(),
name="create_role", name="create_role",
), ),
re_path( path("<int:role_id>/role/edit/", RoleUpdateView.as_view(), name="update_role"),
r"^(?P<role_id>[0-9]+)/role/edit$", RoleUpdateView.as_view(), name="update_role" path(
), "<int:role_id>/role/delete/",
re_path(
r"^(?P<role_id>[0-9]+)/role/delete$",
RoleDeleteView.as_view(), RoleDeleteView.as_view(),
name="delete_role", name="delete_role",
), ),
re_path( path(
r"^(?P<election_id>[0-9]+)/candidate/add$", "<int:election_id>/candidate/add/",
CandidatureCreateView.as_view(), CandidatureCreateView.as_view(),
name="candidate", name="candidate",
), ),
re_path( path(
r"^(?P<candidature_id>[0-9]+)/candidate/edit$", "<int:candidature_id>/candidate/edit/",
CandidatureUpdateView.as_view(), CandidatureUpdateView.as_view(),
name="update_candidate", name="update_candidate",
), ),
re_path( path(
r"^(?P<candidature_id>[0-9]+)/candidate/delete$", "<int:candidature_id>/candidate/delete/",
CandidatureDeleteView.as_view(), CandidatureDeleteView.as_view(),
name="delete_candidate", name="delete_candidate",
), ),
re_path(r"^(?P<election_id>[0-9]+)/vote$", VoteFormView.as_view(), name="vote"), path("<int:election_id>/vote/", VoteFormView.as_view(), name="vote"),
re_path( path("<int:election_id>/detail/", ElectionDetailView.as_view(), name="detail"),
r"^(?P<election_id>[0-9]+)/detail$", ElectionDetailView.as_view(), name="detail"
),
] ]

View File

@ -22,69 +22,62 @@
# #
# #
from django.urls import re_path from django.urls import path
from forum.views import * from forum.views import *
urlpatterns = [ urlpatterns = [
re_path(r"^$", ForumMainView.as_view(), name="main"), path("", ForumMainView.as_view(), name="main"),
re_path(r"^search/$", ForumSearchView.as_view(), name="search"), path("search/", ForumSearchView.as_view(), name="search"),
re_path(r"^new_forum$", ForumCreateView.as_view(), name="new_forum"), path("new_forum/", ForumCreateView.as_view(), name="new_forum"),
re_path( path("mark_all_as_read/", ForumMarkAllAsRead.as_view(), name="mark_all_as_read"),
r"^mark_all_as_read$", ForumMarkAllAsRead.as_view(), name="mark_all_as_read" path("last_unread/", ForumLastUnread.as_view(), name="last_unread"),
), path("favorite_topics/", ForumFavoriteTopics.as_view(), name="favorite_topics"),
re_path(r"^last_unread$", ForumLastUnread.as_view(), name="last_unread"), path("<int:forum_id>/", ForumDetailView.as_view(), name="view_forum"),
re_path( path("<int:forum_id>/edit/", ForumEditView.as_view(), name="edit_forum"),
r"^favorite_topics$", ForumFavoriteTopics.as_view(), name="favorite_topics" path("<int:forum_id>/delete/", ForumDeleteView.as_view(), name="delete_forum"),
), path(
re_path(r"^(?P<forum_id>[0-9]+)$", ForumDetailView.as_view(), name="view_forum"), "<int:forum_id>/new_topic/",
re_path(r"^(?P<forum_id>[0-9]+)/edit$", ForumEditView.as_view(), name="edit_forum"),
re_path(
r"^(?P<forum_id>[0-9]+)/delete$", ForumDeleteView.as_view(), name="delete_forum"
),
re_path(
r"^(?P<forum_id>[0-9]+)/new_topic$",
ForumTopicCreateView.as_view(), ForumTopicCreateView.as_view(),
name="new_topic", name="new_topic",
), ),
re_path( path(
r"^topic/(?P<topic_id>[0-9]+)$", "topic/<int:topic_id>/",
ForumTopicDetailView.as_view(), ForumTopicDetailView.as_view(),
name="view_topic", name="view_topic",
), ),
re_path( path(
r"^topic/(?P<topic_id>[0-9]+)/edit$", "topic/<int:topic_id>/edit/",
ForumTopicEditView.as_view(), ForumTopicEditView.as_view(),
name="edit_topic", name="edit_topic",
), ),
re_path( path(
r"^topic/(?P<topic_id>[0-9]+)/new_message$", "topic/<int:topic_id>/new_message/",
ForumMessageCreateView.as_view(), ForumMessageCreateView.as_view(),
name="new_message", name="new_message",
), ),
re_path( path(
r"^topic/(?P<topic_id>[0-9]+)/toggle_subscribe$", "topic/<int:topic_id>/toggle_subscribe/",
ForumTopicSubscribeView.as_view(), ForumTopicSubscribeView.as_view(),
name="toggle_subscribe_topic", name="toggle_subscribe_topic",
), ),
re_path( path(
r"^message/(?P<message_id>[0-9]+)$", "message/<int:message_id>/",
ForumMessageView.as_view(), ForumMessageView.as_view(),
name="view_message", name="view_message",
), ),
re_path( path(
r"^message/(?P<message_id>[0-9]+)/edit$", "message/<int:message_id>/edit/",
ForumMessageEditView.as_view(), ForumMessageEditView.as_view(),
name="edit_message", name="edit_message",
), ),
re_path( path(
r"^message/(?P<message_id>[0-9]+)/delete$", "message/<int:message_id>/delete/",
ForumMessageDeleteView.as_view(), ForumMessageDeleteView.as_view(),
name="delete_message", name="delete_message",
), ),
re_path( path(
r"^message/(?P<message_id>[0-9]+)/undelete$", "message/<int:message_id>/undelete/",
ForumMessageUndeleteView.as_view(), ForumMessageUndeleteView.as_view(),
name="undelete_message", name="undelete_message",
), ),

View File

@ -22,54 +22,54 @@
# #
# #
from django.urls import re_path from django.urls import path
from launderette.views import * from launderette.views import *
urlpatterns = [ urlpatterns = [
# views # views
re_path(r"^$", LaunderetteMainView.as_view(), name="launderette_main"), path("", LaunderetteMainView.as_view(), name="launderette_main"),
re_path( path(
r"^slot/(?P<slot_id>[0-9]+)/delete$", "slot/<int:slot_id>/delete/",
SlotDeleteView.as_view(), SlotDeleteView.as_view(),
name="delete_slot", name="delete_slot",
), ),
re_path(r"^book$", LaunderetteBookMainView.as_view(), name="book_main"), path("book/", LaunderetteBookMainView.as_view(), name="book_main"),
re_path( path(
r"^book/(?P<launderette_id>[0-9]+)$", "book/<int:launderette_id>/",
LaunderetteBookView.as_view(), LaunderetteBookView.as_view(),
name="book_slot", name="book_slot",
), ),
re_path( path(
r"^(?P<launderette_id>[0-9]+)/click$", "<int:launderette_id>/click/",
LaunderetteMainClickView.as_view(), LaunderetteMainClickView.as_view(),
name="main_click", name="main_click",
), ),
re_path( path(
r"^(?P<launderette_id>[0-9]+)/click/(?P<user_id>[0-9]+)$", "<int:launderette_id>/click/<int:user_id>/",
LaunderetteClickView.as_view(), LaunderetteClickView.as_view(),
name="click", name="click",
), ),
re_path(r"^admin$", LaunderetteListView.as_view(), name="launderette_list"), path("admin/", LaunderetteListView.as_view(), name="launderette_list"),
re_path( path(
r"^admin/(?P<launderette_id>[0-9]+)$", "admin/<int:launderette_id>/",
LaunderetteAdminView.as_view(), LaunderetteAdminView.as_view(),
name="launderette_admin", name="launderette_admin",
), ),
re_path( path(
r"^admin/(?P<launderette_id>[0-9]+)/edit$", "admin/<int:launderette_id>/edit/",
LaunderetteEditView.as_view(), LaunderetteEditView.as_view(),
name="launderette_edit", name="launderette_edit",
), ),
re_path(r"^admin/new$", LaunderetteCreateView.as_view(), name="launderette_new"), path("admin/new/", LaunderetteCreateView.as_view(), name="launderette_new"),
re_path(r"^admin/machine/new$", MachineCreateView.as_view(), name="machine_new"), path("admin/machine/new/", MachineCreateView.as_view(), name="machine_new"),
re_path( path(
r"^admin/machine/(?P<machine_id>[0-9]+)/edit$", "admin/machine/<int:machine_id>/edit/",
MachineEditView.as_view(), MachineEditView.as_view(),
name="machine_edit", name="machine_edit",
), ),
re_path( path(
r"^admin/machine/(?P<machine_id>[0-9]+)/delete$", "admin/machine/<int:machine_id>/delete/",
MachineDeleteView.as_view(), MachineDeleteView.as_view(),
name="machine_delete", name="machine_delete",
), ),

View File

@ -22,13 +22,13 @@
# #
# #
from django.urls import re_path from django.urls import path
from matmat.views import * from matmat.views import *
urlpatterns = [ urlpatterns = [
re_path(r"^$", SearchNormalFormView.as_view(), name="search"), path("", SearchNormalFormView.as_view(), name="search"),
re_path(r"^reverse$", SearchReverseFormView.as_view(), name="search_reverse"), path("reverse/", SearchReverseFormView.as_view(), name="search_reverse"),
re_path(r"^quick$", SearchQuickFormView.as_view(), name="search_quick"), path("quick/", SearchQuickFormView.as_view(), name="search_quick"),
re_path(r"^clear$", SearchClearFormView.as_view(), name="search_clear"), path("clear/", SearchClearFormView.as_view(), name="search_clear"),
] ]

View File

@ -732,9 +732,9 @@ class UVSearchTest(TestCase):
[ [
{ {
"id": 1, "id": 1,
"absolute_url": "/pedagogy/uv/1", "absolute_url": "/pedagogy/uv/1/",
"update_url": "/pedagogy/uv/1/edit", "update_url": "/pedagogy/uv/1/edit/",
"delete_url": "/pedagogy/uv/1/delete", "delete_url": "/pedagogy/uv/1/delete/",
"code": "PA00", "code": "PA00",
"author": 0, "author": 0,
"credit_type": "OM", "credit_type": "OM",

View File

@ -22,33 +22,33 @@
# #
# #
from django.urls import re_path from django.urls import path
from pedagogy.views import * from pedagogy.views import *
urlpatterns = [ urlpatterns = [
# Urls displaying the actual application for visitors # Urls displaying the actual application for visitors
re_path(r"^$", UVListView.as_view(), name="guide"), path("", UVListView.as_view(), name="guide"),
re_path(r"^uv/(?P<uv_id>[0-9]+)$", UVDetailFormView.as_view(), name="uv_detail"), path("uv/<int:uv_id>/", UVDetailFormView.as_view(), name="uv_detail"),
re_path( path(
r"^comment/(?P<comment_id>[0-9]+)/edit$", "comment/<int:comment_id>/edit/",
UVCommentUpdateView.as_view(), UVCommentUpdateView.as_view(),
name="comment_update", name="comment_update",
), ),
re_path( path(
r"^comment/(?P<comment_id>[0-9]+)/delete$", "comment/<int:comment_id>/delete/",
UVCommentDeleteView.as_view(), UVCommentDeleteView.as_view(),
name="comment_delete", name="comment_delete",
), ),
re_path( path(
r"^comment/(?P<comment_id>[0-9]+)/report$", "comment/<int:comment_id>/report/",
UVCommentReportCreateView.as_view(), UVCommentReportCreateView.as_view(),
name="comment_report", name="comment_report",
), ),
# Moderation # Moderation
re_path(r"^moderation$", UVModerationFormView.as_view(), name="moderation"), path("moderation/", UVModerationFormView.as_view(), name="moderation"),
# Administration : Create Update Delete Edit # Administration : Create Update Delete Edit
re_path(r"^uv/create$", UVCreateView.as_view(), name="uv_create"), path("uv/create/", UVCreateView.as_view(), name="uv_create"),
re_path(r"^uv/(?P<uv_id>[0-9]+)/delete$", UVDeleteView.as_view(), name="uv_delete"), path("uv/<int:uv_id>/delete/", UVDeleteView.as_view(), name="uv_delete"),
re_path(r"^uv/(?P<uv_id>[0-9]+)/edit$", UVUpdateView.as_view(), name="uv_update"), path("uv/<int:uv_id>/edit/", UVUpdateView.as_view(), name="uv_update"),
] ]

View File

@ -23,16 +23,16 @@
# #
# #
from django.urls import re_path from django.urls import path
from rootplace.views import * from rootplace.views import *
urlpatterns = [ urlpatterns = [
re_path(r"^merge$", MergeUsersView.as_view(), name="merge"), path("merge/", MergeUsersView.as_view(), name="merge"),
re_path( path(
r"^forum/messages/delete$", "forum/messages/delete/",
DeleteAllForumUserMessagesView.as_view(), DeleteAllForumUserMessagesView.as_view(),
name="delete_forum_messages", name="delete_forum_messages",
), ),
re_path(r"^logs$", OperationLogListView.as_view(), name="operation_logs"), path("logs/", OperationLogListView.as_view(), name="operation_logs"),
] ]

View File

@ -22,40 +22,36 @@
# #
# #
from django.urls import re_path from django.urls import path
from sas.views import * from sas.views import *
urlpatterns = [ urlpatterns = [
re_path(r"^$", SASMainView.as_view(), name="main"), path("", SASMainView.as_view(), name="main"),
re_path(r"^moderation$", ModerationView.as_view(), name="moderation"), path("moderation/", ModerationView.as_view(), name="moderation"),
re_path(r"^album/(?P<album_id>[0-9]+)$", AlbumView.as_view(), name="album"), path("album/<int:album_id>/", AlbumView.as_view(), name="album"),
re_path( path(
r"^album/(?P<album_id>[0-9]+)/upload$", "album/<int:album_id>/upload/",
AlbumUploadView.as_view(), AlbumUploadView.as_view(),
name="album_upload", name="album_upload",
), ),
re_path( path("album/<int:album_id>/edit/", AlbumEditView.as_view(), name="album_edit"),
r"^album/(?P<album_id>[0-9]+)/edit$", AlbumEditView.as_view(), name="album_edit" path("album/<int:album_id>/preview/", send_album, name="album_preview"),
), path("picture/<int:picture_id>/", PictureView.as_view(), name="picture"),
re_path(r"^album/(?P<album_id>[0-9]+)/preview$", send_album, name="album_preview"), path(
re_path(r"^picture/(?P<picture_id>[0-9]+)$", PictureView.as_view(), name="picture"), "picture/<int:picture_id>/edit/",
re_path(
r"^picture/(?P<picture_id>[0-9]+)/edit$",
PictureEditView.as_view(), PictureEditView.as_view(),
name="picture_edit", name="picture_edit",
), ),
re_path(r"^picture/(?P<picture_id>[0-9]+)/download$", send_pict, name="download"), path("picture/<int:picture_id>/download/", send_pict, name="download"),
re_path( path(
r"^picture/(?P<picture_id>[0-9]+)/download/compressed$", "picture/<int:picture_id>/download/compressed/",
send_compressed, send_compressed,
name="download_compressed", name="download_compressed",
), ),
re_path( path(
r"^picture/(?P<picture_id>[0-9]+)/download/thumb$", "picture/<int:picture_id>/download/thumb/",
send_thumb, send_thumb,
name="download_thumb", name="download_thumb",
), ),
# re_path(r'^album/new$', AlbumCreateView.as_view(), name='album_new'),
# re_path(r'^(?P<club_id>[0-9]+)/$', ClubView.as_view(), name='club_view'),
] ]

View File

@ -23,67 +23,65 @@
# #
# #
from django.urls import include, re_path from django.urls import path
from stock.views import * from stock.views import *
urlpatterns = [ urlpatterns = [
# Stock re_paths # Stock re_paths
re_path( path("new/counter/<int:counter_id>/", StockCreateView.as_view(), name="new"),
r"^new/counter/(?P<counter_id>[0-9]+)$", StockCreateView.as_view(), name="new" path("edit/<int:stock_id>/", StockEditView.as_view(), name="edit"),
), path("list/", StockListView.as_view(), name="list"),
re_path(r"^edit/(?P<stock_id>[0-9]+)$", StockEditView.as_view(), name="edit"),
re_path(r"^list$", StockListView.as_view(), name="list"),
# StockItem re_paths # StockItem re_paths
re_path(r"^(?P<stock_id>[0-9]+)$", StockItemList.as_view(), name="items_list"), path("<int:stock_id>/", StockItemList.as_view(), name="items_list"),
re_path( path(
r"^(?P<stock_id>[0-9]+)/stock_item/new_item$", "<int:stock_id>/stock_item/new_item/",
StockItemCreateView.as_view(), StockItemCreateView.as_view(),
name="new_item", name="new_item",
), ),
re_path( path(
r"^stock_item/(?P<item_id>[0-9]+)/edit$", "stock_item/<int:item_id>/edit/",
StockItemEditView.as_view(), StockItemEditView.as_view(),
name="edit_item", name="edit_item",
), ),
re_path( path(
r"^(?P<stock_id>[0-9]+)/stock_item/take_items$", "<int:stock_id>/stock_item/take_items/",
StockTakeItemsBaseFormView.as_view(), StockTakeItemsBaseFormView.as_view(),
name="take_items", name="take_items",
), ),
# ShoppingList re_paths # ShoppingList re_paths
re_path( path(
r"^(?P<stock_id>[0-9]+)/shopping_list/list$", "<int:stock_id>/shopping_list/list/",
StockShoppingListView.as_view(), StockShoppingListView.as_view(),
name="shoppinglist_list", name="shoppinglist_list",
), ),
re_path( path(
r"^(?P<stock_id>[0-9]+)/shopping_list/create$", "<int:stock_id>/shopping_list/create/",
StockItemQuantityBaseFormView.as_view(), StockItemQuantityBaseFormView.as_view(),
name="shoppinglist_create", name="shoppinglist_create",
), ),
re_path( path(
r"^(?P<stock_id>[0-9]+)/shopping_list/(?P<shoppinglist_id>[0-9]+)/items$", "<int:stock_id>/shopping_list/<int:shoppinglist_id>/items/",
StockShoppingListItemListView.as_view(), StockShoppingListItemListView.as_view(),
name="shoppinglist_items", name="shoppinglist_items",
), ),
re_path( path(
r"^(?P<stock_id>[0-9]+)/shopping_list/(?P<shoppinglist_id>[0-9]+)/delete$", "<int:stock_id>/shopping_list/<int:shoppinglist_id>/delete/",
StockShoppingListDeleteView.as_view(), StockShoppingListDeleteView.as_view(),
name="shoppinglist_delete", name="shoppinglist_delete",
), ),
re_path( path(
r"^(?P<stock_id>[0-9]+)/shopping_list/(?P<shoppinglist_id>[0-9]+)/set_done$", "<int:stock_id>/shopping_list/<int:shoppinglist_id>/set_done/",
StockShopppingListSetDone.as_view(), StockShopppingListSetDone.as_view(),
name="shoppinglist_set_done", name="shoppinglist_set_done",
), ),
re_path( path(
r"^(?P<stock_id>[0-9]+)/shopping_list/(?P<shoppinglist_id>[0-9]+)/set_todo$", "<int:stock_id>/shopping_list/<int:shoppinglist_id>/set_todo/",
StockShopppingListSetTodo.as_view(), StockShopppingListSetTodo.as_view(),
name="shoppinglist_set_todo", name="shoppinglist_set_todo",
), ),
re_path( path(
r"^(?P<stock_id>[0-9]+)/shopping_list/(?P<shoppinglist_id>[0-9]+)/update_stock$", "<int:stock_id>/shopping_list/<int:shoppinglist_id>/update_stock/",
StockUpdateAfterShopppingBaseFormView.as_view(), StockUpdateAfterShopppingBaseFormView.as_view(),
name="update_after_shopping", name="update_after_shopping",
), ),

View File

@ -22,12 +22,12 @@
# #
# #
from django.urls import re_path from django.urls import path
from subscription.views import * from subscription.views import *
urlpatterns = [ urlpatterns = [
# Subscription views # Subscription views
re_path(r"^$", NewSubscription.as_view(), name="subscription"), path("", NewSubscription.as_view(), name="subscription"),
re_path(r"stats", SubscriptionsStatsView.as_view(), name="stats"), path("stats/", SubscriptionsStatsView.as_view(), name="stats"),
] ]

View File

@ -23,67 +23,65 @@
# #
# #
from django.urls import re_path from django.urls import path
from trombi.views import * from trombi.views import *
urlpatterns = [ urlpatterns = [
re_path(r"^(?P<club_id>[0-9]+)/new$", TrombiCreateView.as_view(), name="create"), path("<int:club_id>/new/", TrombiCreateView.as_view(), name="create"),
re_path( path("<int:trombi_id>/export/", TrombiExportView.as_view(), name="export"),
r"^(?P<trombi_id>[0-9]+)/export$", TrombiExportView.as_view(), name="export" path("<int:trombi_id>/edit/", TrombiEditView.as_view(), name="edit"),
), path(
re_path(r"^(?P<trombi_id>[0-9]+)/edit$", TrombiEditView.as_view(), name="edit"), "<int:trombi_id>/moderate_comments/",
re_path(
r"^(?P<trombi_id>[0-9]+)/moderate_comments$",
TrombiModerateCommentsView.as_view(), TrombiModerateCommentsView.as_view(),
name="moderate_comments", name="moderate_comments",
), ),
re_path( path(
r"^(?P<comment_id>[0-9]+)/moderate$", "<int:comment_id>/moderate/",
TrombiModerateCommentView.as_view(), TrombiModerateCommentView.as_view(),
name="moderate_comment", name="moderate_comment",
), ),
re_path( path(
r"^user/(?P<user_id>[0-9]+)/delete$", "user/<int:user_id>/delete/",
TrombiDeleteUserView.as_view(), TrombiDeleteUserView.as_view(),
name="delete_user", name="delete_user",
), ),
re_path(r"^(?P<trombi_id>[0-9]+)$", TrombiDetailView.as_view(), name="detail"), path("<int:trombi_id>/", TrombiDetailView.as_view(), name="detail"),
re_path( path(
r"^(?P<user_id>[0-9]+)/new_comment$", "<int:user_id>/new_comment/",
TrombiCommentCreateView.as_view(), TrombiCommentCreateView.as_view(),
name="new_comment", name="new_comment",
), ),
re_path( path(
r"^(?P<user_id>[0-9]+)/profile$", "<int:user_id>/profile/",
UserTrombiProfileView.as_view(), UserTrombiProfileView.as_view(),
name="user_profile", name="user_profile",
), ),
re_path( path(
r"^comment/(?P<comment_id>[0-9]+)/edit$", "comment/<int:comment_id>/edit/",
TrombiCommentEditView.as_view(), TrombiCommentEditView.as_view(),
name="edit_comment", name="edit_comment",
), ),
re_path(r"^tools$", UserTrombiToolsView.as_view(), name="user_tools"), path("tools/", UserTrombiToolsView.as_view(), name="user_tools"),
re_path(r"^profile$", UserTrombiEditProfileView.as_view(), name="profile"), path("profile/", UserTrombiEditProfileView.as_view(), name="profile"),
re_path(r"^pictures$", UserTrombiEditPicturesView.as_view(), name="pictures"), path("pictures/", UserTrombiEditPicturesView.as_view(), name="pictures"),
re_path( path(
r"^reset_memberships$", "reset_memberships/",
UserTrombiResetClubMembershipsView.as_view(), UserTrombiResetClubMembershipsView.as_view(),
name="reset_memberships", name="reset_memberships",
), ),
re_path( path(
r"^membership/(?P<membership_id>[0-9]+)/edit$", "membership/<int:membership_id>/edit/",
UserTrombiEditMembershipView.as_view(), UserTrombiEditMembershipView.as_view(),
name="edit_membership", name="edit_membership",
), ),
re_path( path(
r"^membership/(?P<membership_id>[0-9]+)/delete$", "membership/<int:membership_id>/delete/",
UserTrombiDeleteMembershipView.as_view(), UserTrombiDeleteMembershipView.as_view(),
name="delete_membership", name="delete_membership",
), ),
re_path( path(
r"^membership/(?P<user_id>[0-9]+)/create$", "membership/<int:user_id>/create/",
UserTrombiAddMembershipView.as_view(), UserTrombiAddMembershipView.as_view(),
name="create_membership", name="create_membership",
), ),