X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/099e83b3f8a4e583d987a9f3dd3e4aa3c4501951..9f57f525425707a7c9445c07f00371f17128f44c:/apps/catalogue/forms.py diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index 48faeb15b..b040ef911 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# from django import forms from slughifi import slughifi @@ -15,7 +18,7 @@ class BookImportForm(forms.Form): class SearchForm(forms.Form): - q = JQueryAutoCompleteField('/katalog/tags/', {'minChars': 2, 'selectFirst': True, 'cacheLength': 50}) + q = JQueryAutoCompleteField('/katalog/tags/', {'minChars': 2, 'selectFirst': True, 'cacheLength': 50, 'matchContains': "word"}) tags = forms.CharField(widget=forms.HiddenInput, required=False) def __init__(self, *args, **kwargs): @@ -60,3 +63,19 @@ class NewSetForm(forms.Form): new_set.save() return new_set + +FORMATS = ( + ('mp3', 'MP3'), + ('ogg', 'OGG'), + ('pdf', 'PDF'), + ('odt', 'ODT'), + ('txt', 'TXT'), +) + + +class DownloadFormatsForm(forms.Form): + formats = forms.MultipleChoiceField(required=False, choices=FORMATS, widget=forms.CheckboxSelectMultiple) + + def __init__(self, *args, **kwargs): + super(DownloadFormatsForm, self).__init__(*args, **kwargs) +