forked from DGNum/gestioCOF
Misc fixes
- on vire un commentaire obsolète, et on en remet un à jour - un peu de doc sur les converters
This commit is contained in:
parent
03c74a7940
commit
198658f5f9
3 changed files with 16 additions and 1 deletions
|
@ -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/<slug:app_label>/<slug:model_name>/csv/",
|
||||
csv_views.admin_list_export,
|
||||
{"fields": ["username"]},
|
||||
),
|
||||
"""
|
||||
if not request.user.is_staff:
|
||||
return HttpResponseForbidden()
|
||||
if not queryset:
|
||||
|
|
|
@ -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<type>.+)$', views.export_mega_bytype),
|
||||
path("mega", views.export_mega, name="cof.mega_export"),
|
||||
]
|
||||
|
||||
|
|
|
@ -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}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue