equal
deleted
inserted
replaced
5 class Meta: |
5 class Meta: |
6 model = Task |
6 model = Task |
7 fields = ['title', 'desc', 'tags_field', 'credits'] |
7 fields = ['title', 'desc', 'tags_field', 'credits'] |
8 #publish = forms.BooleanField(required=False) |
8 #publish = forms.BooleanField(required=False) |
9 |
9 |
|
10 def clean_desc(self): |
|
11 data = self.cleaned_data['desc'].strip() |
|
12 if not data: |
|
13 raise forms.ValidationError("Enter some description for the task") |
|
14 |
|
15 return data |
|
16 |
10 def EditTaskForm(task, instance=None): |
17 def EditTaskForm(task, instance=None): |
11 class myForm(forms.ModelForm): |
18 class myForm(forms.ModelForm): |
12 class Meta: |
19 class Meta: |
13 model = Task |
20 model = Task |
14 fields = ['title', 'desc', 'tags_field', 'credits'] |
21 fields = ['title', 'desc', 'tags_field', 'credits'] |
|
22 |
|
23 def clean_desc(self): |
|
24 data = self.cleaned_data['desc'].strip() |
|
25 if not data: |
|
26 raise forms.ValidationError("Enter some description for the task") |
|
27 |
|
28 return data |
|
29 |
15 data = { |
30 data = { |
16 'title': task.title, |
31 'title': task.title, |
17 'desc': task.desc, |
32 'desc': task.desc, |
18 'tags_field': task.tags_field, |
33 'tags_field': task.tags_field, |
19 'credits': task.credits, |
34 'credits': task.credits, |