let as_producer template tag accept a label as input (#19294)

This commit is contained in:
Frédéric Péters 2018-03-09 18:06:54 +01:00
parent ef6e85376d
commit 1c591b3587
1 changed files with 2 additions and 1 deletions

View File

@ -167,8 +167,9 @@ def as_producer(slug):
return {'slug': producer,
'label': settings.TEMPLATE_VARS.get('gnm_commune_name')}
else:
producer = slugify(slug)
try:
producer = re.search(r'(^|\W)producer-(\w*)(\W|$)', slug).group(2).strip()
producer = re.search(r'(^|\W)producer-(\w*)(\W|$)', producer).group(2).strip()
except AttributeError:
pass