From: Stephen Burrows Date: Wed, 13 Apr 2011 19:06:42 +0000 (-0400) Subject: Added 1.2.X compatibility to shipherd LazyNavigationRecurser. X-Git-Tag: philo-0.9~15^2 X-Git-Url: http://git.ithinksw.org/philo.git/commitdiff_plain/986c6b2f6e20f9197098c3bbd01b258fb4535880 Added 1.2.X compatibility to shipherd LazyNavigationRecurser. --- diff --git a/contrib/shipherd/templatetags/shipherd.py b/contrib/shipherd/templatetags/shipherd.py index 1413bdf..6e36126 100644 --- a/contrib/shipherd/templatetags/shipherd.py +++ b/contrib/shipherd/templatetags/shipherd.py @@ -1,4 +1,4 @@ -from django import template +from django import template, VERSION as django_version from django.conf import settings from django.utils.safestring import mark_safe from philo.contrib.shipherd.models import Navigation @@ -60,6 +60,10 @@ class LazyNavigationRecurser(object): context['item'] = item context['children'] = self.__class__(self.template_nodes, item.get_children(), context, request) + # Django 1.2.X compatibility - a lazy recurser will not be called if accessed as a template variable. + if django_version < (1,3): + context['children'] = context['children']() + # Then render the nodelist bit by bit. for node in self.template_nodes: bits.append(node.render(context))