--- a/pytask/taskapp/forms.py Sun Jan 09 00:30:08 2011 +0530
+++ b/pytask/taskapp/forms.py Sun Jan 09 00:52:35 2011 +0530
@@ -1,5 +1,5 @@
from django import forms
-from pytask.taskapp.models import Task, WorkReport
+from pytask.taskapp.models import Task, WorkReport, TaskComment
class CreateTaskForm(forms.ModelForm):
class Meta:
@@ -51,6 +51,21 @@
except Task.DoesNotExist:
return data
+class TaskCommentForm(forms.ModelForm):
+
+ class Meta:
+ model = TaskComment
+ fields = ['data']
+
+ def clean_data(self):
+
+ data = self.cleaned_data['data'].strip()
+ if not data:
+ raise forms.ValidationError("Please add some content")
+
+ return data
+
+
def AddReviewerForm(choices,instance=None):
""" return a form object with appropriate choices """