taskapp/forms/task.py
changeset 178 106909df0c17
parent 165 8ea5bcf3bd01
child 179 8d1fdb148c27
--- a/taskapp/forms/task.py	Tue Mar 02 15:21:45 2010 +0530
+++ b/taskapp/forms/task.py	Tue Mar 02 15:34:51 2010 +0530
@@ -7,11 +7,26 @@
         fields = ['title', 'desc', 'tags_field', 'credits']
     #publish = forms.BooleanField(required=False)
 
+    def clean_desc(self):
+        data = self.cleaned_data['desc'].strip()
+        if not data:
+            raise forms.ValidationError("Enter some description for the task")
+
+        return data
+
 def EditTaskForm(task, instance=None):
     class myForm(forms.ModelForm):
         class Meta:
             model = Task
             fields = ['title', 'desc', 'tags_field', 'credits']
+
+        def clean_desc(self):
+            data = self.cleaned_data['desc'].strip()
+            if not data:
+                raise forms.ValidationError("Enter some description for the task")
+
+            return data
+
     data = {
         'title': task.title,
         'desc': task.desc,