taskapp/forms/task.py
changeset 151 d0cb85ba462a
parent 136 8632a44b743d
child 165 8ea5bcf3bd01
--- a/taskapp/forms/task.py	Sun Feb 28 18:31:10 2010 +0530
+++ b/taskapp/forms/task.py	Sun Feb 28 19:31:41 2010 +0530
@@ -12,7 +12,7 @@
     
     class myform(forms.Form):
         mentor = forms.ChoiceField(choices=choices, required=True)
-    form = myform(instance=instance) if instance else myform()
+    form = myform(instance) if instance else myform()
     return form
 
 class ClaimTaskForm(forms.ModelForm):
@@ -20,12 +20,12 @@
         model = Claim
         fields = ['message']
 
-def ChoiceForm(choices):
+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()
+    form = myform(instance) if instance else myform()
     return form
 
 def AddTaskForm(task_choices, is_plain=False):