Commit 413e0a5df3e9fa065ad31c09d7e75f8dbbda6b09

Authored by Jailson Dias
1 parent 5b858dde

update gitignore

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