--- a/taskapp/forms/task.py Thu Mar 04 18:30:55 2010 +0530
+++ b/taskapp/forms/task.py Thu Mar 04 19:08:47 2010 +0530
@@ -1,5 +1,5 @@
from django import forms
-from pytask.taskapp.models import Task, Claim
+from pytask.taskapp.models import Task
class TaskCreateForm(forms.ModelForm):
class Meta:
@@ -53,10 +53,15 @@
form = myform(instance) if instance else myform()
return form
-class ClaimTaskForm(forms.ModelForm):
- class Meta:
- model = Claim
- fields = ['message']
+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):
""" return a form object with appropriate choices """