@ -159,14 +159,40 @@ class TreeNodePridatView(generic.View):
}
}
def post ( self , request , * args , * * kwargs ) :
def post ( self , request , * args , * * kwargs ) :
######## FIXME: ROZEPSANE, NEFUNGUJE, DOPSAT !!!!!! ###########
node = s . TreeNode . objects . get ( pk = self . kwargs [ ' pk ' ] )
node = s . TreeNode . objects . get ( pk = self . kwargs [ ' pk ' ] )
kam = self . kwargs [ ' kam ' ]
kam = self . kwargs [ ' kam ' ]
co = self . kwargs [ ' co ' ]
typ = self . type_from_str [ co ]
raise NotImplementedError ( ' Neni to dopsane, dopis to! ' )
if kam not in ( ' pred ' , ' syn ' , ' za ' ) :
raise ValidationError ( ' Přidat lze pouze před nebo za node nebo jako syna ' )
if co == m . TextNode :
new_obj = m . Text ( )
new_obj . save ( )
elif co == m . CastNode :
new_obj = m . CastNode ( )
new_obj . nadpis = request . POST . get ( ' pridat-castNode- {} - {} ' . format ( node . id , kam ) )
new_obj . save ( )
elif co == m . ReseniNode :
new_obj = m .
pass
elif co == m . UlohaZadaniNode :
pass
elif co == m . UlohaReseniNode :
pass
else :
new_obj = None
if kam == ' pred ' :
pass
if kam not in ( ' syn ' , ' za ' ) :
raise ValidationError ( ' Přidat lze pouze před nebo za node ' )
if kam == ' syn ' :
if kam == ' syn ' :
strtyp = request . POST . get ( ' pridat-typ- {} -syn ' . format ( node . id ) )
typ = self . type_from_str [ strtyp ]
if typ == m . TextNode :
if typ == m . TextNode :
text_obj = m . Text ( )
text_obj = m . Text ( )
text_obj . save ( )
text_obj . save ( )
@ -174,8 +200,6 @@ class TreeNodePridatView(generic.View):
else :
else :
node = treelib . create_child ( node , typ )
node = treelib . create_child ( node , typ )
if kam == ' za ' :
if kam == ' za ' :
strtyp = request . POST . get ( ' pridat-typ- {} -za ' . format ( node . id ) )
typ = self . type_from_str [ strtyp ]
if typ == m . TextNode :
if typ == m . TextNode :
text_obj = m . Text ( )
text_obj = m . Text ( )
text_obj . save ( )
text_obj . save ( )
@ -226,7 +250,7 @@ class SirotcinecView(generic.ListView):
template_name = ' seminar/orphanage.html '
template_name = ' seminar/orphanage.html '
def get_queryset ( self ) :
def get_queryset ( self ) :
return s . TreeNode . objects . not_instance_of ( s . RocnikNode ) . filter ( root = None , succ = None , father_of_first = None )
return s . TreeNode . objects . not_instance_of ( s . RocnikNode ) . filter ( root = None , prev = None , succ = None , father_of_first = None )
class ProblemView ( generic . DetailView ) :
class ProblemView ( generic . DetailView ) :
model = s . Problem
model = s . Problem