diff options
Diffstat (limited to 'taskapp/forms')
-rw-r--r-- | taskapp/forms/task.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/taskapp/forms/task.py b/taskapp/forms/task.py index 1bcdc6f..d3cea32 100644 --- a/taskapp/forms/task.py +++ b/taskapp/forms/task.py @@ -27,3 +27,17 @@ def AssignTaskForm(choices, instance=None): user = forms.ChoiceField(choices=choices, required=True) form = myform() return form + +def AddTaskForm(task_choices, is_plain=False): + """ if is_plain is true, it means the task has no subs/deps. + so we also give a radio button to choose between subs and dependencies. + else we only give choices. + """ + + class myForm(forms.Form): + if is_plain: + type_choices = [('S','Subtasks'),('D','Dependencies')] + type = forms.ChoiceField(type_choices, widget=forms.RadioSelect) + + task = forms.MultipleChoiceField(choices=task_choices) + return myForm() |