Pass a copy of the entire context to the navigation subtemplate when calling it from sublist template

This commit is contained in:
Roberto Rosario
2011-12-25 03:14:19 -04:00
parent 80fab8b70d
commit de49d4a588
2 changed files with 8 additions and 9 deletions
@@ -4,7 +4,7 @@
{% with link.permissions as permissions %} {% with link.permissions as permissions %}
{% check_permissions request.user permissions %} {% check_permissions request.user permissions %}
{% check_access permissions request.user navigation_object %} {% check_access permissions request.user object %}
{% if permission or access %} {% if permission or access %}
{% if as_li %} {% if as_li %}
@@ -249,13 +249,12 @@ def get_object_navigation_links(parser, token):
@register.inclusion_tag('generic_navigation.html', takes_context=True) @register.inclusion_tag('generic_navigation.html', takes_context=True)
def object_navigation_template(context): def object_navigation_template(context):
# Pass the list object to the navigation template as the navigation object new_context = copy.copy(context)
return { new_context.update({
'navigation_object': context['object'] if 'object' in context else None,
'request': context['request'],
'horizontal': True, 'horizontal': True,
'object_navigation_links': _get_object_navigation_links(context) 'object_navigation_links': _get_object_navigation_links(context)
} })
return new_context
@register.tag @register.tag