fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update translation
[redakcja.git]
/
apps
/
catalogue
/
forms.py
diff --git
a/apps/catalogue/forms.py
b/apps/catalogue/forms.py
index
cbb1ad9
..
6c704b9
100644
(file)
--- 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']
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
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.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()
if self.instance:
self.field().initial = self.initial()
@@
-63,7
+63,12
@@
class TagForm(forms.Form):
class TagSingleForm(TagForm):
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']
def field(self):
return self.fields['tag']
@@
-76,7
+81,12
@@
class TagSingleForm(TagForm):
class TagMultipleForm(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']
def field(self):
return self.fields['tags']