Misc urlconf files

This commit is contained in:
Ludovic Stephan 2019-04-12 17:07:03 +02:00
parent 271732f40d
commit 8fc6f96324
3 changed files with 32 additions and 44 deletions

View file

@ -37,11 +37,6 @@ def export(qs, fields=None):
def admin_list_export( def admin_list_export(
request, model_name, app_label, queryset=None, fields=None, list_display=True 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<app_label>[\d\w]+)/(?P<model_name>[\d\w]+)/csv/',
'util.csv_view.admin_list_export'),
"""
if not request.user.is_staff: if not request.user.is_staff:
return HttpResponseForbidden() return HttpResponseForbidden()
if not queryset: if not queryset:

View file

@ -1,51 +1,44 @@
from django.conf.urls import url from django.urls import path
from gestioncof import views from gestioncof import views
from gestioncof.decorators import buro_required
export_patterns = [ export_patterns = [
url(r"^members$", views.export_members, name="cof.membres_export"), path("members", views.export_members, name="cof.membres_export"),
url( path(
r"^mega/avecremarques$", "mega/avecremarques",
views.export_mega_remarksonly, views.export_mega_remarksonly,
name="cof.mega_export_remarks", name="cof.mega_export_remarks",
), ),
url( path(
r"^mega/participants$", "mega/participants",
views.export_mega_participants, views.export_mega_participants,
name="cof.mega_export_participants", name="cof.mega_export_participants",
), ),
url(r"^mega/orgas$", views.export_mega_orgas, name="cof.mega_export_orgas"), path("mega/orgas", views.export_mega_orgas, name="cof.mega_export_orgas"),
# url(r'^mega/(?P<type>.+)$', views.export_mega_bytype), # path(r'^mega/(?P<type>.+)$', views.export_mega_bytype),
url(r"^mega$", views.export_mega, name="cof.mega_export"), path("mega", views.export_mega, name="cof.mega_export"),
] ]
surveys_patterns = [ surveys_patterns = [
url( path("<int:survey_id>/status", views.survey_status, name="survey.details.status"),
r"^(?P<survey_id>\d+)/status$", path("<int:survey_id>", views.survey, name="survey.details"),
views.survey_status,
name="survey.details.status",
),
url(r"^(?P<survey_id>\d+)$", views.survey, name="survey.details"),
] ]
events_patterns = [ events_patterns = [
url(r"^(?P<event_id>\d+)$", views.event, name="event.details"), path("<int:event_id>", views.event, name="event.details"),
url(r"^(?P<event_id>\d+)/status$", views.event_status, name="event.details.status"), path("<int:event_id>/status", views.event_status, name="event.details.status"),
] ]
calendar_patterns = [ calendar_patterns = [
url(r"^subscription$", views.calendar, name="calendar"), path("subscription", views.calendar, name="calendar"),
url( path("<slug:token>/calendar.ics", views.calendar_ics, name="calendar.ics"),
r"^(?P<token>[a-z0-9-]+)/calendar.ics$", views.calendar_ics, name="calendar.ics"
),
] ]
clubs_patterns = [ clubs_patterns = [
url(r"^membres/(?P<name>\w+)", views.membres_club, name="membres-club"), path("membres/<slug:name>", views.membres_club, name="membres-club"),
url(r"^liste", views.liste_clubs, name="liste-clubs"), path("liste", views.liste_clubs, name="liste-clubs"),
url( path(
r"^change_respo/(?P<club_name>\w+)/(?P<user_id>\d+)", "change_respo/<slug:club_name>/<int:user_id>",
views.change_respo, views.change_respo,
name="change-respo", name="change-respo",
), ),

View file

@ -1,35 +1,35 @@
from django.conf.urls import url from django.urls import path
from gestioncof.decorators import buro_required from gestioncof.decorators import buro_required
from petitscours import views from petitscours import views
from petitscours.views import DemandeDetailView, DemandeListView from petitscours.views import DemandeDetailView, DemandeListView
urlpatterns = [ urlpatterns = [
url(r"^inscription$", views.inscription, name="petits-cours-inscription"), path("inscription", views.inscription, name="petits-cours-inscription"),
url(r"^demande$", views.demande, name="petits-cours-demande"), path("demande", views.demande, name="petits-cours-demande"),
url( path(
r"^demande-raw$", "demande-raw",
views.demande, views.demande,
kwargs={"raw": True}, kwargs={"raw": True},
name="petits-cours-demande-raw", name="petits-cours-demande-raw",
), ),
url( path(
r"^demandes$", "demandes",
buro_required(DemandeListView.as_view()), buro_required(DemandeListView.as_view()),
name="petits-cours-demandes-list", name="petits-cours-demandes-list",
), ),
url( path(
r"^demandes/(?P<pk>\d+)$", "demandes/<int:pk>",
buro_required(DemandeDetailView.as_view()), buro_required(DemandeDetailView.as_view()),
name="petits-cours-demande-details", name="petits-cours-demande-details",
), ),
url( path(
r"^demandes/(?P<demande_id>\d+)/traitement$", "demandes/<int:demande_id>/traitement",
views.traitement, views.traitement,
name="petits-cours-demande-traitement", name="petits-cours-demande-traitement",
), ),
url( path(
r"^demandes/(?P<demande_id>\d+)/retraitement$", "demandes/<int:demande_id>/retraitement",
views.traitement, views.traitement,
kwargs={"redo": True}, kwargs={"redo": True},
name="petits-cours-demande-retraitement", name="petits-cours-demande-retraitement",