From 67fb4b7849c8f99f36dbd5f6186cac8f263284c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20S=C3=A9chet?= Date: Mon, 9 May 2022 16:22:16 +0200 Subject: [PATCH] backoffice: prevent custom views and ics & CardPage views slug conflict (#64981) --- wcs/custom_views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wcs/custom_views.py b/wcs/custom_views.py index c1a005764..3900ce38e 100644 --- a/wcs/custom_views.py +++ b/wcs/custom_views.py @@ -20,6 +20,7 @@ import xml.etree.ElementTree as ET from django.utils.encoding import force_text from quixote import get_publisher +from wcs.backoffice.data_management import CardPage from wcs.carddef import CardDef from wcs.formdef import FormDef from wcs.qommon.misc import simplify @@ -117,7 +118,11 @@ class CustomView(StorableObject): # prevent conflicts with system view names from wcs.backoffice.management import FormPage - if base_slug in [x if isinstance(x, str) else x[0] for x in FormPage._q_exports]: + reserved_slugs = [ + x if isinstance(x, str) else x[0] for x in FormPage._q_exports + CardPage._q_exports + ] + ['ics'] + + if base_slug in reserved_slugs: base_slug = 'x-' + base_slug self.slug = base_slug -- 2.35.1