From 198658f5f9caf498f3adbc3ee45ba27b66fc7994 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Tue, 21 May 2019 15:30:51 +0200 Subject: [PATCH] Misc fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - on vire un commentaire obsolète, et on en remet un à jour - un peu de doc sur les converters --- gestioncof/csv_views.py | 9 +++++++++ gestioncof/urls.py | 1 - kfet/converters.py | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gestioncof/csv_views.py b/gestioncof/csv_views.py index 2b66d495..3c163091 100644 --- a/gestioncof/csv_views.py +++ b/gestioncof/csv_views.py @@ -37,6 +37,15 @@ 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: + + path( + "admin///csv/", + csv_views.admin_list_export, + {"fields": ["username"]}, + ), + """ if not request.user.is_staff: return HttpResponseForbidden() if not queryset: diff --git a/gestioncof/urls.py b/gestioncof/urls.py index e35f9c32..6a07eac9 100644 --- a/gestioncof/urls.py +++ b/gestioncof/urls.py @@ -15,7 +15,6 @@ export_patterns = [ name="cof.mega_export_participants", ), 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"), ] diff --git a/kfet/converters.py b/kfet/converters.py index 4b0842fe..94400587 100644 --- a/kfet/converters.py +++ b/kfet/converters.py @@ -1,3 +1,10 @@ +""" +Les converters sont la méthode "clean" de faire les regex custom dans des URLs django. +Plus d'info dans la doc : +https://docs.djangoproject.com/en/2.2/topics/http/urls/#registering-custom-path-converters +""" + + class TrigrammeConverter: regex = ".{3}"