added form to select users
authorNishanth Amuluru <nishanth@fossee.in>
Sun, 09 Jan 2011 11:52:09 +0530
changeset 359 fc26de9c943f
parent 358 da71bdf58be7
child 360 b4988ede9e3d
added form to select users
pytask/taskapp/forms.py
--- a/pytask/taskapp/forms.py	Sun Jan 09 11:51:48 2011 +0530
+++ b/pytask/taskapp/forms.py	Sun Jan 09 11:52:09 2011 +0530
@@ -77,6 +77,14 @@
             raise forms.ValidationError('Enter something as a proposal')
         return data
 
+def ChoiceForm(choices, data=None):
+    """ return a form object with appropriate choices """
+    
+    class myform(forms.Form):
+        choice = forms.ChoiceField(choices=choices, required=True)
+    form = myform(data) if data else myform()
+    return form
+
 def AddReviewerForm(choices,instance=None):
     """ return a form object with appropriate choices """
     
@@ -85,16 +93,6 @@
     form = myform(instance) if instance else myform()
     return form
 
-
-
-def ChoiceForm(choices, instance=None):
-    """ return a form object with appropriate choices """
-    
-    class myform(forms.Form):
-        choice = forms.ChoiceField(choices=choices, required=True)
-    form = myform(instance) if instance else 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.