django2: Replace assignment_tag with simple_tag
https://docs.djangoproject.com/en/2.0/releases/1.9/#assignment-tag blueprint django2-support Change-Id: Ib5021a4030fd9bc954365a352bdf4dccd049d28e
This commit is contained in:
parent
e477eafa45
commit
826720ada3
@ -52,7 +52,7 @@ def site_branding_link():
|
||||
|
||||
# TODO(jeffjapan): This is just an assignment tag version of the above, replace
|
||||
# when the dashboard is upgraded to a django version that
|
||||
# supports the @assignment_tag decorator syntax instead.
|
||||
# supports the @simple_tag decorator syntax instead.
|
||||
class SaveBrandingNode(template.Node):
|
||||
def __init__(self, var_name):
|
||||
self.var_name = var_name
|
||||
|
@ -199,19 +199,19 @@ def jstemplate(parser, token):
|
||||
return JSTemplateNode(nodelist)
|
||||
|
||||
|
||||
@register.assignment_tag
|
||||
@register.simple_tag
|
||||
def load_config():
|
||||
return conf
|
||||
|
||||
|
||||
@register.assignment_tag
|
||||
@register.simple_tag
|
||||
def datepicker_locale():
|
||||
locale_mapping = getattr(settings, 'DATEPICKER_LOCALES',
|
||||
bootstrap_datepicker.LOCALE_MAPPING)
|
||||
return locale_mapping.get(translation.get_language(), 'en')
|
||||
|
||||
|
||||
@register.assignment_tag
|
||||
@register.simple_tag
|
||||
def template_cache_age():
|
||||
return getattr(settings, 'NG_TEMPLATE_CACHE_AGE', 0)
|
||||
|
||||
|
@ -34,14 +34,14 @@ def is_multidomain_supported():
|
||||
False))
|
||||
|
||||
|
||||
@register.assignment_tag(takes_context=True)
|
||||
@register.simple_tag(takes_context=True)
|
||||
def is_multi_region(context):
|
||||
if 'request' not in context:
|
||||
return False
|
||||
return is_multi_region_configured(context['request'])
|
||||
|
||||
|
||||
@register.assignment_tag
|
||||
@register.simple_tag
|
||||
def is_multidomain():
|
||||
return is_multidomain_supported()
|
||||
|
||||
|
@ -67,22 +67,22 @@ def find_asset(theme, asset):
|
||||
return staticfiles_storage.url(pathname2url(return_path))
|
||||
|
||||
|
||||
@register.assignment_tag()
|
||||
@register.simple_tag()
|
||||
def themes():
|
||||
return hz_themes.get_selectable_themes()
|
||||
|
||||
|
||||
@register.assignment_tag()
|
||||
@register.simple_tag()
|
||||
def theme_cookie():
|
||||
return hz_themes.get_theme_cookie_name()
|
||||
|
||||
|
||||
@register.assignment_tag()
|
||||
@register.simple_tag()
|
||||
def theme_dir():
|
||||
return hz_themes.get_theme_dir()
|
||||
|
||||
|
||||
@register.assignment_tag(takes_context=True)
|
||||
@register.simple_tag(takes_context=True)
|
||||
def current_theme(context):
|
||||
return get_theme(context.request)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user