taskapp/forms/task.py
changeset 89 1cc03941ed5d
parent 50 d40e86f958f7
child 90 b2426897ff18
--- a/taskapp/forms/task.py	Wed Feb 24 20:33:45 2010 +0530
+++ b/taskapp/forms/task.py	Thu Feb 25 02:11:49 2010 +0530
@@ -27,3 +27,17 @@
         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()