Exemplo n.º 1
0
 def testVerifyChildEdges(self):
     print "\n\n\n############## testVerifyChildEdges"
     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.getDescendentEdgesForObject(org)
         print "Object: " + str(org)
         print "Descendants: " + str(ancestry)
         
     for usr in ExtUser.objects.all():
         ancestry = traversal.getDescendentEdgesForObject(usr)
         print "Object: " + str(usr)
         print "Descendants: " + str(ancestry)
Exemplo n.º 2
0
def get_descendents(content_obj):
    descendents = traversal.getDescendentEdgesForObject(content_obj)
    if len(descendents) > 0:
        return (
            '<div class="descendants"><h3>Children</h3><h4>'
            + str(content_obj)
            + "</h4><ul>"
            + render_edgetree_as_ul(descendents, "children")
            + "</ul></div>"
        )
    else:
        return '<div class="parents"><h4>No children</h4></div>'