Regression in 1.2.4 if not using django.core.context_processors.request
mikemcgowan opened this issue · comments
The new template tag that was added in templatetags/admin_style_tags.py
in 1.2.4 ...
from django.contrib.sites.shortcuts import get_current_site
@register.simple_tag(takes_context=True)
def current_site_name(context):
request = context.get('request')
site = get_current_site(request)
return site.name
... breaks Django projects that aren't using django.core.context_processors.request
. This is a shame, because in 1.2.3 and earlier djangocms-admin-style
didn't require django.core.context_processors.request
. It seems a shame to introduce an unnecessary dependency.
The following changeset would fix it:
diff --git a/djangocms_admin_style/templatetags/admin_style_tags.py b/djangocms_admin_style/templatetags/admin_style_tags.py
index 8ba5de9..0d2fe20 100644
--- a/djangocms_admin_style/templatetags/admin_style_tags.py
+++ b/djangocms_admin_style/templatetags/admin_style_tags.py
@@ -19,6 +19,8 @@ register = template.Library()
@register.simple_tag(takes_context=True)
def current_site_name(context):
request = context.get('request')
+ if request is None:
+ return 'My Site'
site = get_current_site(request)
return site.name
Thanks for reporting.
We've fixed this in 1137aa1