X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/18b53f03ffd1620e2f3f5b1c17e7dd12c6a6afa6..a46c356186d0b84328f33a1a9b8198cb70602eaa:/apps/catalogue/forms.py diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index cbb1ad9d..6c704b96 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -32,7 +32,7 @@ class DocumentCreateForm(forms.Form): def clean_cover(self): cover = self.cleaned_data['cover'] - if cover and cover.name.rsplit('.', 1)[-1].lower() not in ('jpg', 'jpeg', 'png', 'gif', 'tif', 'tiff'): + if cover and cover.name.rsplit('.', 1)[-1].lower() not in ('jpg', 'jpeg', 'png', 'gif', 'svg'): raise forms.ValidationError(_('The cover should be an image file (jpg/png/gif)')) return file @@ -43,7 +43,7 @@ class TagForm(forms.Form): self.category = category self.instance = instance self.field().queryset = Tag.objects.filter(category=self.category) - self.field().label = self.category.label + self.field().label = self.category.label.capitalize() if self.instance: self.field().initial = self.initial() @@ -63,7 +63,12 @@ class TagForm(forms.Form): class TagSingleForm(TagForm): - tag = forms.ModelChoiceField(Tag.objects.none()) + tag = forms.ModelChoiceField( + Tag.objects.none(), + widget=forms.Select(attrs={ + 'class': 'form-control', + }) + ) def field(self): return self.fields['tag'] @@ -76,7 +81,12 @@ class TagSingleForm(TagForm): class TagMultipleForm(TagForm): - tags = forms.ModelMultipleChoiceField(Tag.objects.none(), required=False) + tags = forms.ModelMultipleChoiceField( + Tag.objects.none(), required=False, + widget=forms.SelectMultiple(attrs={ + 'class': 'chosen-select', + 'data-placeholder': _('Choose'), + })) def field(self): return self.fields['tags']