taskapp/forms/task.py
changeset 89 1cc03941ed5d
parent 50 d40e86f958f7
child 90 b2426897ff18
equal deleted inserted replaced
88:0b6d251d3c30 89:1cc03941ed5d
    25     
    25     
    26     class myform(forms.Form):
    26     class myform(forms.Form):
    27         user = forms.ChoiceField(choices=choices, required=True)
    27         user = forms.ChoiceField(choices=choices, required=True)
    28     form = myform()
    28     form = myform()
    29     return form
    29     return form
       
    30 
       
    31 def AddTaskForm(task_choices, is_plain=False):
       
    32     """ if is_plain is true, it means the task has no subs/deps.
       
    33     so we also give a radio button to choose between subs and dependencies.
       
    34     else we only give choices.
       
    35     """
       
    36 
       
    37     class myForm(forms.Form):
       
    38         if is_plain:
       
    39             type_choices = [('S','Subtasks'),('D','Dependencies')]
       
    40             type = forms.ChoiceField(type_choices, widget=forms.RadioSelect)
       
    41 
       
    42         task = forms.MultipleChoiceField(choices=task_choices)
       
    43     return myForm()