Check if a node is a root node the proper way, make 'root' translatable

This commit is contained in:
Roberto Rosario
2014-05-19 20:04:51 -04:00
parent 5e45d1970f
commit 79e28ca853

View File

@@ -2,6 +2,7 @@
from __future__ import absolute_import
from django.utils.html import mark_safe
from django.utils.translation import ugettext
from .models import IndexInstanceNode
@@ -82,8 +83,8 @@ def node_level(x):
u''.join(
[
u'     ' * (getattr(x, x._mptt_meta.level_attr) - 1),
u'' if x.parent else u'',
unicode(x if x.parent else 'root')
u'' if x.is_root_node() else u'',
ugettext('root') if x.is_root_node() else unicode(x)
]
)
)