def setUpClass(cls): cls.sitetree = SiteTree() tree_ttags = Tree(alias='ttags') tree_ttags.save() cls.tree_ttags = tree_ttags tree_ttags_root = TreeItem(title='root', tree=tree_ttags, url='/', insitetree=True, inbreadcrumbs=True, inmenu=True) tree_ttags_root.save() cls.tree_ttags_root = tree_ttags_root tree_ttags_root_child1 = TreeItem(title='sometitle', tree=tree_ttags, parent=tree_ttags_root, url='/child1', insitetree=True, inbreadcrumbs=True, inmenu=True, hint='somehint', description='somedescr') tree_ttags_root_child1.save() cls.tree_ttags_root_child1 = tree_ttags_root_child1
def setUpClass(cls): cls.sitetree = SiteTree() t1 = Tree(alias='main') t1.save(force_insert=True) t1_root = TreeItem(title='root', tree=t1, url='/', alias='for_dynamic') t1_root.save(force_insert=True) cls.t1 = t1 cls.t1_root = t1_root
def setUpClass(cls): cls.sitetree = SiteTree() t1 = Tree(alias='tree1') t1.save(force_insert=True) t1_root = TreeItem(title='root', tree=t1, url='/') t1_root.save(force_insert=True) t1_root_child1 = TreeItem(title='child1', tree=t1, parent=t1_root, url='/about/') t1_root_child1.save(force_insert=True) t1_root_child2 = TreeItem(title='child2', tree=t1, parent=t1_root, url='articles_list', urlaspattern=True) t1_root_child2.save(force_insert=True) t1_root_child2_sub1 = TreeItem(title='subchild1', tree=t1, parent=t1_root_child2, url='articles_detailed art_id', urlaspattern=True) t1_root_child2_sub1.save(force_insert=True) t1_root_child2_sub2 = TreeItem(title='subchild2', tree=t1, parent=t1_root_child2, url='/not_articles/10/') t1_root_child2_sub2.save(force_insert=True) t2 = Tree(alias='tree2') t2.save(force_insert=True) t2_root1 = TreeItem(title='{{ t2_root1_title }}', tree=t2, url='/') t2_root1.save(force_insert=True) t2_root2 = TreeItem(title='put {{ t2_root2_title }} inside', tree=t2, url='/sub/') t2_root2.save(force_insert=True) t2_root3 = TreeItem(title='for logged in only', tree=t2, url='/some/', access_loggedin=True) t2_root3.save(force_insert=True) cls.t1 = t1 cls.t1_root = t1_root cls.t1_root_child1 = t1_root_child1 cls.t1_root_child2 = t1_root_child2 cls.t1_root_child2_sub1 = t1_root_child2_sub1 cls.t1_root_child2_sub2 = t1_root_child2_sub2 cls.t2 = t2 cls.t2_root1 = t2_root1 cls.t2_root2 = t2_root2 cls.t2_root3 = t2_root3 # set urlconf to test's one cls.old_urlconf = urlresolvers.get_urlconf() urlresolvers.set_urlconf('sitetree.tests')
def setUpClass(cls): cls.sitetree = SiteTree() t1 = Tree(alias='tree3') t1.save(force_insert=True) t1_root = TreeItem(title='root', tree=t1, url='/', hidden=True) t1_root.save(force_insert=True) t1_root_child1 = TreeItem(title='child1', tree=t1, parent=t1_root, url='/0/', access_loggedin=True) t1_root_child1.save(force_insert=True) t1_root_child2 = TreeItem(title='child2', tree=t1, parent=t1_root, url='/1/', inmenu=True, hidden=True) t1_root_child2.save(force_insert=True) t1_root_child3 = TreeItem(title='child3', tree=t1, parent=t1_root, url='/2/', inmenu=False) t1_root_child3.save(force_insert=True) t1_root_child4 = TreeItem(title='child4', tree=t1, parent=t1_root, url='/3/', hidden=True) t1_root_child4.save(force_insert=True) t1_root_child5 = TreeItem(title='child5', tree=t1, parent=t1_root, url='/4/', inmenu=True, hidden=True) t1_root_child5.save(force_insert=True) t2 = Tree(alias='tree3_en') t2.save(force_insert=True) t2_root = TreeItem(title='root_en', tree=t2, url='/') t2_root.save(force_insert=True) t2_root_child1 = TreeItem(title='child1_en', tree=t2, parent=t2_root, url='/0_en/') t2_root_child1.save(force_insert=True) t2_root_child2 = TreeItem(title='child2_en', tree=t2, parent=t2_root, url='/1_en/') t2_root_child2.save(force_insert=True) cls.t1 = t1 cls.t1_root = t1_root cls.t1_root_child1 = t1_root_child1 cls.t1_root_child2 = t1_root_child2 cls.t1_root_child2 = t1_root_child3 cls.t1_root_child2 = t1_root_child4 cls.t1_root_child2 = t1_root_child5 cls.t2_root = t2_root
def setUpClass(cls): cls.sitetree = SiteTree() t1 = Tree(alias='tree1') t1.save(force_insert=True) t1_root = TreeItem(title='root', tree=t1, url='/') t1_root.save(force_insert=True) t1_root_child1 = TreeItem(title='child1', tree=t1, parent=t1_root, url='/about/') t1_root_child1.save(force_insert=True) t1_root_child2 = TreeItem(title='child2', tree=t1, parent=t1_root, url='articles_list', urlaspattern=True, description='items_descr') t1_root_child2.save(force_insert=True) t1_root_child2_sub1 = TreeItem(title='subchild1', tree=t1, parent=t1_root_child2, url='articles_detailed art_id', urlaspattern=True) t1_root_child2_sub1.save(force_insert=True) t1_root_child2_sub2 = TreeItem(title='subchild2', tree=t1, parent=t1_root_child2, url='/not_articles/10/') t1_root_child2_sub2.save(force_insert=True) t1_root_child3 = TreeItem(title='child_with_var_str', tree=t1, parent=t1_root, url='somevar_str', urlaspattern=True) t1_root_child3.save(force_insert=True) t1_root_child4 = TreeItem(title='child_with_var_list', tree=t1, parent=t1_root, url='somevar_list', urlaspattern=True) t1_root_child4.save(force_insert=True) t2 = Tree(alias='tree2') t2.save(force_insert=True) t2_root1 = TreeItem(title='{{ t2_root1_title }}', tree=t2, url='/') t2_root1.save(force_insert=True) t2_root2 = TreeItem(title='put {{ t2_root2_title }} inside', tree=t2, url='/sub/') t2_root2.save(force_insert=True) t2_root3 = TreeItem(title='for logged in only', tree=t2, url='/some/', access_loggedin=True) t2_root3.save(force_insert=True) t2_root4 = TreeItem(title='url quoting', tree=t2, url='url 2 put_var', urlaspattern=True) t2_root4.save(force_insert=True) t2_root5 = TreeItem(title='url quoting 1.5 style', tree=t2, url="'url' 2 put_var", urlaspattern=True) t2_root5.save(force_insert=True) t2_root6 = TreeItem(title='url quoting 1.5 style', tree=t2, url='"url" 2 put_var', urlaspattern=True) t2_root6.save(force_insert=True) t2_root7 = TreeItem(title='for guests only', tree=t2, url='/some_other/', access_guest=True) t2_root7.save(force_insert=True) cls.t1 = t1 cls.t1_root = t1_root cls.t1_root_child1 = t1_root_child1 cls.t1_root_child2 = t1_root_child2 cls.t1_root_child3 = t1_root_child3 cls.t1_root_child2_sub1 = t1_root_child2_sub1 cls.t1_root_child2_sub2 = t1_root_child2_sub2 cls.t2 = t2 cls.t2_root1 = t2_root1 cls.t2_root2 = t2_root2 cls.t2_root3 = t2_root3 cls.t2_root4 = t2_root4 cls.t2_root5 = t2_root5 cls.t2_root6 = t2_root6 cls.t2_root7 = t2_root7
def init_trees(cls): cls.sitetree = SiteTree() ########################################################### t1 = Tree(alias='tree1') t1.save() cls.t1 = t1 t1_root = TreeItem(title='root', tree=t1, url='/') t1_root.save() cls.tree_ttags_root = t1_root t1_root_child1 = TreeItem(title='child1', tree=t1, parent=t1_root, url='/about/') t1_root_child1.save() cls.tree_ttags_root_child1 = t1_root_child1 t1_root_child2 = TreeItem(title='child2', tree=t1, parent=t1_root, url='articles_list', urlaspattern=True, description='items_descr') t1_root_child2.save() cls.t1_root_child2 = t1_root_child2 t1_root_child2_sub1 = TreeItem(title='subchild1', tree=t1, parent=t1_root_child2, url='articles_detailed art_id', urlaspattern=True) t1_root_child2_sub1.save() cls.t1_root_child2_sub1 = t1_root_child2_sub1 t1_root_child2_sub2 = TreeItem(title='subchild2', tree=t1, parent=t1_root_child2, url='/not_articles/10/') t1_root_child2_sub2.save() cls.t1_root_child2_sub2 = t1_root_child2_sub2 t1_root_child3 = TreeItem(title='child_with_var_str', tree=t1, parent=t1_root, url='somevar_str', urlaspattern=True) t1_root_child3.save() cls.t1_root_child3 = t1_root_child3 t1_root_child4 = TreeItem(title='child_with_var_list', tree=t1, parent=t1_root, url='somevar_list', urlaspattern=True) t1_root_child4.save() t2 = Tree(alias='tree2') t2.save() cls.t2 = t2 t2_root1 = TreeItem(title='{{ t2_root1_title }}', tree=t2, url='/') t2_root1.save() cls.t2_root1 = t2_root1 t2_root2 = TreeItem(title='put {{ t2_root2_title }} inside', tree=t2, url='/sub/') t2_root2.save() cls.t2_root2 = t2_root2 t2_root3 = TreeItem(title='for logged in only', tree=t2, url='/some/', access_loggedin=True) t2_root3.save() cls.t2_root3 = t2_root3 t2_root4 = TreeItem(title='url quoting', tree=t2, url='url 2 put_var', urlaspattern=True) t2_root4.save() cls.t2_root4 = t2_root4 t2_root5 = TreeItem(title='url quoting 1.5 style', tree=t2, url="'url' 2 put_var", urlaspattern=True) t2_root5.save() cls.t2_root5 = t2_root5 t2_root6 = TreeItem(title='url quoting 1.5 style', tree=t2, url='"url" 2 put_var', urlaspattern=True) t2_root6.save() cls.t2_root6 = t2_root6 t2_root7 = TreeItem(title='for guests only', tree=t2, url='/some_other/', access_guest=True) t2_root7.save() cls.t2_root7 = t2_root7 ########################################################### t3 = Tree(alias='tree3') t3.save() cls.t3 = t3 t3_en_root = TreeItem(title='root', tree=t3, url='/', hidden=True) t3_en_root.save() cls.t3_root = t3_en_root t3_root_child1 = TreeItem(title='child1', tree=t3, parent=t3_en_root, url='/0/', access_loggedin=True) t3_root_child1.save() cls.t3_root_child1 = t3_root_child1 t3_root_child2 = TreeItem(title='child2', tree=t3, parent=t3_en_root, url='/1/', inmenu=True, hidden=True) t3_root_child2.save() cls.t3_root_child2 = t3_root_child2 t3_root_child3 = TreeItem(title='child3', tree=t3, parent=t3_en_root, url='/the_same_url/', inmenu=False) t3_root_child3.save() cls.t3_root_child3 = t3_root_child3 t3_root_child4 = TreeItem(title='child4', tree=t3, parent=t3_en_root, url='/3/', hidden=True) t3_root_child4.save() cls.t3_root_child4 = t3_root_child4 t3_root_child5 = TreeItem(title='child5', tree=t3, parent=t3_en_root, url='/4/', inmenu=True, hidden=True) t3_root_child5.save() cls.t3_root_child5 = t3_root_child5 t3_en = Tree(alias='tree3_en', title='tree3en_title') t3_en.save() cls.t3_en = t3_en t3_en_root = TreeItem(title='root_en', tree=t3_en, url='/') t3_en_root.save() cls.t3_en_root = t3_en_root t3_en_root_child1 = TreeItem(title='child1_en', tree=t3_en, parent=t3_en_root, url='/0_en/') t3_en_root_child1.save() t3_en_root_child2 = TreeItem(title='child2_en', tree=t3_en, parent=t3_en_root, url='/the_same_url/') t3_en_root_child2.save() ########################################################### tree_main = Tree(alias='main') tree_main.save() cls.tree_main = tree_main tree_main_root = TreeItem(title='root', tree=tree_main, url='/', alias='for_dynamic') tree_main_root.save() cls.tree_main_root = tree_main_root