forms.py
1.15 KB
# -*- coding: utf-8 -*-
from django.forms import Form, ModelMultipleChoiceField, ModelChoiceField, \
BooleanField, CharField, Textarea
from django.utils.translation import ugettext_lazy as _
from dictionary.forms import QualifierField
from dictionary.models import Vocabulary, Variant
class ExportForm(Form):
vocabs = ModelMultipleChoiceField(
queryset=Vocabulary.objects.all(), label=_(u'dictionaries'))
antivocabs = ModelMultipleChoiceField(
queryset=Vocabulary.objects.all(), label=_(u'antidictionaries'),
required=False)
variant = ModelChoiceField(
queryset=Variant.objects.filter(type=Variant.TYPE_EXPORT),
label=_(u'variant'))
refl = BooleanField(label=_(u'tags with "refl"'), required=False)
commonness = BooleanField(label=_(u'commonness labels'), required=False)
copyright = CharField(widget=Textarea(attrs={'cols': 80, 'rows': 40}))
# excluding_qualifiers = QualifiersField(
# required=False, label=_(u'excluding qualifiers'))
class MagicQualifierForm(Form):
qualifier = QualifierField(label=_(u'lexeme qual.'))
regex = CharField(label=_(u'tag pattern'), required=False)