templatetags: add as_producer to get collectivity from slug (#18461)
This commit is contained in:
parent
56fe422c1c
commit
d93b39185a
|
@ -19,6 +19,7 @@ import datetime
|
|||
import re
|
||||
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from combo.data.models import ConfigJsonCell
|
||||
|
@ -123,3 +124,12 @@ def is_place_page(page):
|
|||
if not page:
|
||||
return False
|
||||
return page.template_name == 'place'
|
||||
|
||||
|
||||
@register.filter
|
||||
def as_producer(slug):
|
||||
if slug.startswith('_'):
|
||||
collectivity = slug.split('_')[1]
|
||||
return {'slug': collectivity,
|
||||
'label': settings.KNOWN_SERVICES['hobo'].get('hobo-%s' % collectivity, {'title': ''})['title']}
|
||||
return {'slug': 'grandlyon', 'label': 'Grand Lyon'}
|
||||
|
|
Loading…
Reference in New Issue