forms.py 1.14 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'słowniki'))
    antivocabs = ModelMultipleChoiceField(
        queryset=Vocabulary.objects.all(), label=_(u'antysłowniki'),
        required=False)
    variant = ModelChoiceField(
        queryset=Variant.objects.filter(type=Variant.TYPE_EXPORT),
        label=_(u'wariant'))
    refl = BooleanField(label=_(u'tagi z "refl"'), required=False)
    commonness = BooleanField(label=_(u'etykiety pospolitości'), required=False)
    copyright = CharField(widget=Textarea(attrs={'cols': 80, 'rows': 40}))
    # excluding_qualifiers = QualifiersField(
    #     required=False, label=_(u'kwal. wykluczające'))


class MagicQualifierForm(Form):
    qualifier = QualifierField(label=_(u'kwal. leksemu'))
    regex = CharField(label=_(u'wzorzec tagu'), required=False)