created form for making a claim
authorNishanth Amuluru <nishanth@fossee.in>
Sun, 09 Jan 2011 11:13:36 +0530
changeset 352 1a88b04adb39
parent 351 ac75d3cfa96f
child 353 181d4eb9f419
created form for making a claim
pytask/taskapp/forms.py
--- a/pytask/taskapp/forms.py	Sun Jan 09 10:46:12 2011 +0530
+++ b/pytask/taskapp/forms.py	Sun Jan 09 11:13:36 2011 +0530
@@ -1,5 +1,5 @@
 from django import forms
-from pytask.taskapp.models import Task, WorkReport, TaskComment
+from pytask.taskapp.models import Task, WorkReport, TaskComment, TaskClaim
 
 class CreateTaskForm(forms.ModelForm):
     class Meta:
@@ -65,6 +65,17 @@
 
         return data
 
+class ClaimTaskForm(forms.ModelForm):
+
+    class Meta:
+        model = TaskClaim
+        fields = ["proposal"]
+
+    def clean_proposal(self):
+        data = self.cleaned_data['proposal'].strip()
+        if not data:
+            raise forms.ValidationError('Enter something as a proposal')
+        return data
 
 def AddReviewerForm(choices,instance=None):
     """ return a form object with appropriate choices """
@@ -74,14 +85,6 @@
     form = myform(instance) if instance else myform()
     return form
 
-class ClaimTaskForm(forms.Form):
-    message = forms.CharField(label="Proposal")
-
-    def clean_message(self):
-        data = self.cleaned_data['message'].strip()
-        if not data:
-            raise forms.ValidationError('Enter something as a proposal')
-        return data
 
 
 def ChoiceForm(choices, instance=None):