From 8fc6f96324a3a3c5afa5fd965dd8e37b602296f8 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Fri, 12 Apr 2019 17:07:03 +0200 Subject: [PATCH] Misc urlconf files --- gestioncof/csv_views.py | 5 ----- gestioncof/urls.py | 45 +++++++++++++++++------------------------ petitscours/urls.py | 26 ++++++++++++------------ 3 files changed, 32 insertions(+), 44 deletions(-) diff --git a/gestioncof/csv_views.py b/gestioncof/csv_views.py index e85c78b0..2b66d495 100644 --- a/gestioncof/csv_views.py +++ b/gestioncof/csv_views.py @@ -37,11 +37,6 @@ def export(qs, fields=None): def admin_list_export( request, model_name, app_label, queryset=None, fields=None, list_display=True ): - """ - Put the following line in your urls.py BEFORE your admin include - (r'^admin/(?P[\d\w]+)/(?P[\d\w]+)/csv/', - 'util.csv_view.admin_list_export'), - """ if not request.user.is_staff: return HttpResponseForbidden() if not queryset: diff --git a/gestioncof/urls.py b/gestioncof/urls.py index e1e36a17..e35f9c32 100644 --- a/gestioncof/urls.py +++ b/gestioncof/urls.py @@ -1,51 +1,44 @@ -from django.conf.urls import url +from django.urls import path from gestioncof import views -from gestioncof.decorators import buro_required export_patterns = [ - url(r"^members$", views.export_members, name="cof.membres_export"), - url( - r"^mega/avecremarques$", + path("members", views.export_members, name="cof.membres_export"), + path( + "mega/avecremarques", views.export_mega_remarksonly, name="cof.mega_export_remarks", ), - url( - r"^mega/participants$", + path( + "mega/participants", views.export_mega_participants, name="cof.mega_export_participants", ), - url(r"^mega/orgas$", views.export_mega_orgas, name="cof.mega_export_orgas"), - # url(r'^mega/(?P.+)$', views.export_mega_bytype), - url(r"^mega$", views.export_mega, name="cof.mega_export"), + path("mega/orgas", views.export_mega_orgas, name="cof.mega_export_orgas"), + # path(r'^mega/(?P.+)$', views.export_mega_bytype), + path("mega", views.export_mega, name="cof.mega_export"), ] surveys_patterns = [ - url( - r"^(?P\d+)/status$", - views.survey_status, - name="survey.details.status", - ), - url(r"^(?P\d+)$", views.survey, name="survey.details"), + path("/status", views.survey_status, name="survey.details.status"), + path("", views.survey, name="survey.details"), ] events_patterns = [ - url(r"^(?P\d+)$", views.event, name="event.details"), - url(r"^(?P\d+)/status$", views.event_status, name="event.details.status"), + path("", views.event, name="event.details"), + path("/status", views.event_status, name="event.details.status"), ] calendar_patterns = [ - url(r"^subscription$", views.calendar, name="calendar"), - url( - r"^(?P[a-z0-9-]+)/calendar.ics$", views.calendar_ics, name="calendar.ics" - ), + path("subscription", views.calendar, name="calendar"), + path("/calendar.ics", views.calendar_ics, name="calendar.ics"), ] clubs_patterns = [ - url(r"^membres/(?P\w+)", views.membres_club, name="membres-club"), - url(r"^liste", views.liste_clubs, name="liste-clubs"), - url( - r"^change_respo/(?P\w+)/(?P\d+)", + path("membres/", views.membres_club, name="membres-club"), + path("liste", views.liste_clubs, name="liste-clubs"), + path( + "change_respo//", views.change_respo, name="change-respo", ), diff --git a/petitscours/urls.py b/petitscours/urls.py index f230846e..b4bf1538 100644 --- a/petitscours/urls.py +++ b/petitscours/urls.py @@ -1,35 +1,35 @@ -from django.conf.urls import url +from django.urls import path from gestioncof.decorators import buro_required from petitscours import views from petitscours.views import DemandeDetailView, DemandeListView urlpatterns = [ - url(r"^inscription$", views.inscription, name="petits-cours-inscription"), - url(r"^demande$", views.demande, name="petits-cours-demande"), - url( - r"^demande-raw$", + path("inscription", views.inscription, name="petits-cours-inscription"), + path("demande", views.demande, name="petits-cours-demande"), + path( + "demande-raw", views.demande, kwargs={"raw": True}, name="petits-cours-demande-raw", ), - url( - r"^demandes$", + path( + "demandes", buro_required(DemandeListView.as_view()), name="petits-cours-demandes-list", ), - url( - r"^demandes/(?P\d+)$", + path( + "demandes/", buro_required(DemandeDetailView.as_view()), name="petits-cours-demande-details", ), - url( - r"^demandes/(?P\d+)/traitement$", + path( + "demandes//traitement", views.traitement, name="petits-cours-demande-traitement", ), - url( - r"^demandes/(?P\d+)/retraitement$", + path( + "demandes//retraitement", views.traitement, kwargs={"redo": True}, name="petits-cours-demande-retraitement",