def get_ancestors(content_obj):
    
    ancestors = traversal.getAncestorEdgesForObject(content_obj)    
    if len(ancestors) > 0:
        return '<div class="parents"><h3>Parents</h3><h4>' + str(content_obj) + '</h4><ul>' + render_edgetree_as_ul(ancestors,'parents') + '</ul></div>'
    else:
        return '<div class="parents"><h4>No ancestors</h4></div>'    
示例#2
0
文件: basic.py 项目: rtighe/rapidsms
 def testVerifyParentEdges(self):
     print "\n\n\n############## testVerifyParentEdges"
     Organization.objects.all().delete()
     ExtUser.objects.all().delete()
     Edge.objects.all().delete()
     EdgeType.objects.all().delete()
     
     
     management.call_command('runscript', 'demo_bootstrap.py', verbosity=0)
         
     
     for org in Organization.objects.all():
         ancestry = traversal.getAncestorEdgesForObject(org)
         print "Object: " + str(org)
         print "Ancestors: " + str(ancestry)
         
     for usr in ExtUser.objects.all():
         ancestry = traversal.getAncestorEdgesForObject(usr)
         print "Object: " + str(usr)
         print "Ancestors: " + str(ancestry)