Added per-request cache to get_admin_interface_theme template tag #19
This commit is contained in:
@@ -11,5 +11,17 @@ register = template.Library()
|
||||
@register.assignment_tag(takes_context = True)
|
||||
def get_admin_interface_theme(context):
|
||||
|
||||
return Theme.get_active_theme()
|
||||
theme = None
|
||||
request = context.get('request', None)
|
||||
|
||||
if request:
|
||||
theme = getattr(request, 'admin_interface_theme', None)
|
||||
|
||||
if not theme:
|
||||
theme = Theme.get_active_theme()
|
||||
|
||||
if request:
|
||||
request.admin_interface_theme = theme
|
||||
|
||||
return theme
|
||||
|
||||
|
||||
Reference in New Issue
Block a user