X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/e0164e6ca0588a270b77d892702e54ef62c31de2..54e4ec4a3aac555f44ea604c12a3955592b5d568:/apps/catalogue/forms.py?ds=sidebyside diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index 094aaaf23..9707e793d 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -56,7 +56,7 @@ class ObjectSetsForm(forms.Form): self.fields['set_ids'] = forms.MultipleChoiceField( label=_('Shelves'), required=False, - choices=[(tag.id, "%s (%s)" % (tag.name, tag.get_count())) for tag in Tag.objects.filter(category='set', user=user)], + choices=[(tag.id, "%s (%s)" % (tag.name, tag.book_count)) for tag in Tag.objects.filter(category='set', user=user)], initial=[tag.id for tag in obj.tags.filter(category='set', user=user)], widget=forms.CheckboxSelectMultiple ) @@ -78,20 +78,12 @@ class NewSetForm(forms.Form): return new_set -FORMATS = ( - ('mp3', 'MP3'), - ('ogg', 'OGG'), - ('pdf', 'PDF'), - ('odt', 'ODT'), - ('txt', 'TXT'), - ('epub', 'EPUB'), - ('daisy', 'DAISY'), - ('mobi', 'MOBI'), -) +FORMATS = [(f, f.upper()) for f in Book.ebook_formats] class DownloadFormatsForm(forms.Form): - formats = forms.MultipleChoiceField(required=False, choices=FORMATS, widget=forms.CheckboxSelectMultiple) + formats = forms.MultipleChoiceField(required=False, choices=FORMATS, + widget=forms.CheckboxSelectMultiple) def __init__(self, *args, **kwargs): super(DownloadFormatsForm, self).__init__(*args, **kwargs)