diff --git a/.gitignore b/.gitignore index aeeceaa..6c66b24 100644 --- a/.gitignore +++ b/.gitignore @@ -51,5 +51,6 @@ coverage.xml angular_api logs/ amadeus/uploads/ +data/ links/static/images/ uploads/ diff --git a/mural/forms.py b/mural/forms.py index 90df879..63b779e 100644 --- a/mural/forms.py +++ b/mural/forms.py @@ -14,7 +14,7 @@ class Validation(forms.ModelForm): def clean_post(self): post = self.cleaned_data.get('post', '') cleaned_post = strip_tags(post) - + if cleaned_post == '': self._errors['post'] = [_('This field is required.')] @@ -40,7 +40,8 @@ class GeneralPostForm(Validation): fields = ['action', 'post', 'image'] widgets = { 'action': forms.RadioSelect, - 'post': forms.Textarea + 'post': forms.Textarea, + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}), } class CategoryPostForm(Validation): @@ -49,7 +50,8 @@ class CategoryPostForm(Validation): fields = ['action', 'post', 'image'] widgets = { 'action': forms.RadioSelect, - 'post': forms.Textarea + 'post': forms.Textarea, + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}), } class SubjectPostForm(Validation): @@ -60,7 +62,7 @@ class SubjectPostForm(Validation): subject = kwargs['initial'].get('subject', None) if not kwargs['instance'] is None: - subject = self.instance.space + subject = self.instance.space if user.is_staff: 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): fields = ['action', 'resource', 'post', 'image'] widgets = { 'action': forms.RadioSelect, - 'post': forms.Textarea + 'post': forms.Textarea, + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}), } class ResourcePostForm(Validation): @@ -83,7 +86,8 @@ class ResourcePostForm(Validation): fields = ['action', 'post', 'image'] widgets = { 'action': forms.RadioSelect, - 'post': forms.Textarea + 'post': forms.Textarea, + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}), } class CommentForm(forms.ModelForm): @@ -92,7 +96,7 @@ class CommentForm(forms.ModelForm): def clean_comment(self): comment = self.cleaned_data.get('comment', '') cleaned_comment = strip_tags(comment) - + if cleaned_comment == '': self._errors['comment'] = [_('This field is required.')] @@ -114,4 +118,7 @@ class CommentForm(forms.ModelForm): class Meta: model = Comment - fields = ['comment', 'image'] \ No newline at end of file + fields = ['comment', 'image'] + widgets = { + 'image': forms.ClearableFileInput(attrs={'accept':'image/*'}), + } -- libgit2 0.21.2