empty description for a task not allowed. white space around description trimmed.
--- 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,