forms.py 1.06 KB
# -*- coding: utf-8 -*-
from django.forms import Form, ModelMultipleChoiceField, ModelChoiceField, \
    BooleanField, CharField, Textarea
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)