Commit 413e0a5df3e9fa065ad31c09d7e75f8dbbda6b09

Authored by Jailson Dias
1 parent 5b858dde

update gitignore

Showing 2 changed files with 16 additions and 8 deletions   Show diff stats
@@ -51,5 +51,6 @@ coverage.xml @@ -51,5 +51,6 @@ coverage.xml
51 angular_api 51 angular_api
52 logs/ 52 logs/
53 amadeus/uploads/ 53 amadeus/uploads/
  54 +data/
54 links/static/images/ 55 links/static/images/
55 uploads/ 56 uploads/
mural/forms.py
@@ -14,7 +14,7 @@ class Validation(forms.ModelForm): @@ -14,7 +14,7 @@ class Validation(forms.ModelForm):
14 def clean_post(self): 14 def clean_post(self):
15 post = self.cleaned_data.get('post', '') 15 post = self.cleaned_data.get('post', '')
16 cleaned_post = strip_tags(post) 16 cleaned_post = strip_tags(post)
17 - 17 +
18 if cleaned_post == '': 18 if cleaned_post == '':
19 self._errors['post'] = [_('This field is required.')] 19 self._errors['post'] = [_('This field is required.')]
20 20
@@ -40,7 +40,8 @@ class GeneralPostForm(Validation): @@ -40,7 +40,8 @@ class GeneralPostForm(Validation):
40 fields = ['action', 'post', 'image'] 40 fields = ['action', 'post', 'image']
41 widgets = { 41 widgets = {
42 'action': forms.RadioSelect, 42 'action': forms.RadioSelect,
43 - 'post': forms.Textarea 43 + 'post': forms.Textarea,
  44 + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}),
44 } 45 }
45 46
46 class CategoryPostForm(Validation): 47 class CategoryPostForm(Validation):
@@ -49,7 +50,8 @@ class CategoryPostForm(Validation): @@ -49,7 +50,8 @@ class CategoryPostForm(Validation):
49 fields = ['action', 'post', 'image'] 50 fields = ['action', 'post', 'image']
50 widgets = { 51 widgets = {
51 'action': forms.RadioSelect, 52 'action': forms.RadioSelect,
52 - 'post': forms.Textarea 53 + 'post': forms.Textarea,
  54 + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}),
53 } 55 }
54 56
55 class SubjectPostForm(Validation): 57 class SubjectPostForm(Validation):
@@ -60,7 +62,7 @@ class SubjectPostForm(Validation): @@ -60,7 +62,7 @@ class SubjectPostForm(Validation):
60 subject = kwargs['initial'].get('subject', None) 62 subject = kwargs['initial'].get('subject', None)
61 63
62 if not kwargs['instance'] is None: 64 if not kwargs['instance'] is None:
63 - subject = self.instance.space 65 + subject = self.instance.space
64 66
65 if user.is_staff: 67 if user.is_staff:
66 self.fields['resource'].choices = [(r.id, str(r)) for r in Resource.objects.filter(Q(topic__subject = subject))] 68 self.fields['resource'].choices = [(r.id, str(r)) for r in Resource.objects.filter(Q(topic__subject = subject))]
@@ -74,7 +76,8 @@ class SubjectPostForm(Validation): @@ -74,7 +76,8 @@ class SubjectPostForm(Validation):
74 fields = ['action', 'resource', 'post', 'image'] 76 fields = ['action', 'resource', 'post', 'image']
75 widgets = { 77 widgets = {
76 'action': forms.RadioSelect, 78 'action': forms.RadioSelect,
77 - 'post': forms.Textarea 79 + 'post': forms.Textarea,
  80 + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}),
78 } 81 }
79 82
80 class ResourcePostForm(Validation): 83 class ResourcePostForm(Validation):
@@ -83,7 +86,8 @@ class ResourcePostForm(Validation): @@ -83,7 +86,8 @@ class ResourcePostForm(Validation):
83 fields = ['action', 'post', 'image'] 86 fields = ['action', 'post', 'image']
84 widgets = { 87 widgets = {
85 'action': forms.RadioSelect, 88 'action': forms.RadioSelect,
86 - 'post': forms.Textarea 89 + 'post': forms.Textarea,
  90 + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}),
87 } 91 }
88 92
89 class CommentForm(forms.ModelForm): 93 class CommentForm(forms.ModelForm):
@@ -92,7 +96,7 @@ class CommentForm(forms.ModelForm): @@ -92,7 +96,7 @@ class CommentForm(forms.ModelForm):
92 def clean_comment(self): 96 def clean_comment(self):
93 comment = self.cleaned_data.get('comment', '') 97 comment = self.cleaned_data.get('comment', '')
94 cleaned_comment = strip_tags(comment) 98 cleaned_comment = strip_tags(comment)
95 - 99 +
96 if cleaned_comment == '': 100 if cleaned_comment == '':
97 self._errors['comment'] = [_('This field is required.')] 101 self._errors['comment'] = [_('This field is required.')]
98 102
@@ -114,4 +118,7 @@ class CommentForm(forms.ModelForm): @@ -114,4 +118,7 @@ class CommentForm(forms.ModelForm):
114 118
115 class Meta: 119 class Meta:
116 model = Comment 120 model = Comment
117 - fields = ['comment', 'image']  
118 \ No newline at end of file 121 \ No newline at end of file
  122 + fields = ['comment', 'image']
  123 + widgets = {
  124 + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}),
  125 + }