Esempio n. 1
0
class DefinitionForm(forms.ModelForm):
    role = forms.ChoiceField(label=_(u'Type'), choices=build_choice_list('NoteType'),
                             widget=forms.Select(attrs=ATTRS_FOR_FORMS))

    class Meta:
        model = Definition
        fields = ('published','count', 'role', 'text')
Esempio n. 2
0
class OtherMediaForm(forms.ModelForm):

    gloss = forms.CharField()
    file = forms.FileField()
    type = forms.ChoiceField(choices=build_choice_list('OtherMediaType'),widget=forms.Select(attrs=ATTRS_FOR_FORMS))
    alternative_gloss = forms.TextInput()

    class Meta:
        model = OtherMedia
        fields = ['type']
Esempio n. 3
0
class MorphemeMorphologyForm(forms.ModelForm):
    """Morphology specification for a Morpheme"""

    parent_gloss_id = forms.CharField(label=_(u'Parent Gloss'))
    role = forms.ChoiceField(label=_(u'Type'),choices=build_choice_list('MorphologyType'),widget=forms.Select(attrs=ATTRS_FOR_FORMS), required=True)
    morpheme_id = forms.CharField(label=_(u'Morpheme'))

    class Meta:
        model = MorphologyDefinition
        fields = ['role']
Esempio n. 4
0
UNKNOWNBOOLEANCHOICES = [(0,'---------'),(1,'Unknown'),(2,'True'),(3,'False')]
NEUTRALBOOLEANCHOICES = [(1,'Neutral'),(2,'Yes'),(3,'No')]
NEUTRALQUERYCHOICES = [(0,'---------'),(1,'Neutral'),(2,'True'),(3,'False')]

RELATION_ROLE_CHOICES = (('','---------'),
                         ('all', 'All'),
                         ('homonym', 'Homonym'),
                         ('synonym', 'Synonym'),
                         ('variant', 'Variant'),
                         ('antonym', 'Antonym'),
                         ('hyponym', 'Hyponym'),
                         ('hypernym', 'Hypernym'),
                         ('seealso', 'See Also'),
                         )

DEFN_ROLE_CHOICES = [('','---------'),('all','All')] + build_choice_list('NoteType')
COMPONENT_ROLE_CHOICES = [('','---------')] + build_choice_list('MorphologyType')
MORPHEME_ROLE_CHOICES = [('','---------')] + build_choice_list('MorphemeType')
ATTRS_FOR_FORMS = {'class':'form-control'}

class GlossSearchForm(forms.ModelForm):

    use_required_attribute = False #otherwise the html required attribute will show up on every form

    search = forms.CharField(label=_("Dutch Gloss"))
    sortOrder = forms.CharField(label=_("Sort Order"), initial="idgloss")       # Used in glosslistview to store user-selection
    englishGloss = forms.CharField(label=_("English Gloss"))
    lemmaGloss = forms.CharField(label=_("Lemma Gloss"))
    tags = forms.MultipleChoiceField(choices=[(tag.name, tag.name.replace('_',' ')) for tag in Tag.objects.all()])
    nottags = forms.MultipleChoiceField(choices=[(tag.name, tag.name) for tag in Tag.objects.all()])
    keyword = forms.CharField(label=_(u'Translations'))
Esempio n. 5
0
 def test_build_choice_list(self):
     """Test that function returns proper values."""
     # TODO: Simulate OperationalError?
     self.assertListEqual(build_choice_list(self.field), self.choices)
Esempio n. 6
0
YESNOCHOICES = (("unspecified", "Unspecified" ), ('yes', 'Yes'), ('no', 'No'))
NULLBOOLEANCHOICES = [(0,'---------'),(1,'Unknown'),(2,'True'),(3,'False')]

RELATION_ROLE_CHOICES = (('','---------'),
                         ('all', 'All'),
                         ('homonym', 'Homonym'),
                         ('synonym', 'Synonym'),
                         ('variant', 'Variant'),
                         ('antonym', 'Antonym'),
                         ('hyponym', 'Hyponym'),
                         ('hypernym', 'Hypernym'),
                         ('seealso', 'See Also'),
                         )

DEFN_ROLE_CHOICES = (('','---------'),('all','All')) + DEFN_ROLE_CHOICES;
MORPHEME_ROLE_CHOICES = [('','---------')] + build_choice_list('MorphologyType');
ATTRS_FOR_FORMS = {'class':'form-control'};


class GlossSearchForm(forms.ModelForm):

    search = forms.CharField(label="Dutch Gloss")
    englishGloss = forms.CharField(label="English Gloss")
    tags = forms.MultipleChoiceField(choices=[(tag.name, tag.name) for tag in Tag.objects.all()])
    nottags = forms.MultipleChoiceField(choices=[(tag.name, tag.name) for tag in Tag.objects.all()])
    keyword = forms.CharField(label='Translations')
    hasvideo = forms.ChoiceField(label='Has Video', choices=YESNOCHOICES)
    defspublished = forms.ChoiceField(label="All Definitions Published", choices=YESNOCHOICES)
    
    defsearch = forms.CharField(label='Search Definition/Notes')
    #defrole = forms.ChoiceField(label='Search Definition/Note Type', choices=ROLE_CHOICES, widget=forms.Select(attrs={'class': 'form-control'}))
Esempio n. 7
0
UNKNOWNBOOLEANCHOICES = [(0,'---------'),(1,'Unknown'),(2,'True'),(3,'False')]
NEUTRALBOOLEANCHOICES = [(1,'Neutral'),(2,'Yes'),(3,'No')]
NEUTRALQUERYCHOICES = [(0,'---------'),(1,'Neutral'),(2,'True'),(3,'False')]

RELATION_ROLE_CHOICES = (('','---------'),
                         ('all', 'All'),
                         ('homonym', 'Homonym'),
                         ('synonym', 'Synonym'),
                         ('variant', 'Variant'),
                         ('antonym', 'Antonym'),
                         ('hyponym', 'Hyponym'),
                         ('hypernym', 'Hypernym'),
                         ('seealso', 'See Also'),
                         )

DEFN_ROLE_CHOICES = [('','---------'),('all','All')] + build_choice_list('NoteType')
COMPONENT_ROLE_CHOICES = [('','---------')] + build_choice_list('MorphologyType')
MORPHEME_ROLE_CHOICES = [('','---------')] + build_choice_list('MorphemeType')
ATTRS_FOR_FORMS = {'class':'form-control'}

class GlossSearchForm(forms.ModelForm):

    use_required_attribute = False #otherwise the html required attribute will show up on every form

    search = forms.CharField(label=_("Dutch Gloss"))
    sortOrder = forms.CharField(label=_("Sort Order"))       # Used in glosslistview to store user-selection
    englishGloss = forms.CharField(label=_("English Gloss"))
    tags = forms.MultipleChoiceField(choices=[(tag.name, tag.name.replace('_',' ')) for tag in Tag.objects.all()])
    nottags = forms.MultipleChoiceField(choices=[(tag.name, tag.name) for tag in Tag.objects.all()])
    keyword = forms.CharField(label=_(u'Translations'))
    hasvideo = forms.ChoiceField(label=_(u'Has Video'), choices=YESNOCHOICES)
Esempio n. 8
0
RELATION_ROLE_CHOICES = (
    ('', '---------'),
    ('all', 'All'),
    ('homonym', 'Homonym'),
    ('synonym', 'Synonym'),
    ('variant', 'Variant'),
    ('antonym', 'Antonym'),
    ('hyponym', 'Hyponym'),
    ('hypernym', 'Hypernym'),
    ('seealso', 'See Also'),
)

DEFN_ROLE_CHOICES = (('', '---------'), ('all', 'All')) + DEFN_ROLE_CHOICES
COMPONENT_ROLE_CHOICES = [('', '---------')
                          ] + build_choice_list('MorphologyType')
MORPHEME_ROLE_CHOICES = [('', '---------')] + build_choice_list('MorphemeType')
ATTRS_FOR_FORMS = {
    'class': 'form-control'
}


class GlossSearchForm(forms.ModelForm):

    search = forms.CharField(label=_("Dutch Gloss"))
    sortOrder = forms.CharField(
        label=_("Sort Order"),
        initial="idgloss")  # Used in glosslistview to store user-selection
    englishGloss = forms.CharField(label=_("English Gloss"))
    tags = forms.MultipleChoiceField(choices=[(tag.name,
                                               tag.name.replace('_', ' '))
Esempio n. 9
0
    # Translators: RELATION_ROLE_CHOICES
    ("hypernym", _("Hypernym")),
    # Translators: RELATION_ROLE_CHOICES
    ("seealso", _("See Also")),
)

# Translators: This is a choice option that probably represents nothing, don't translate if not needed to.
DEFN_ROLE_CHOICES = (
    ("", _("---------")),
    # Translators: DEFN_ROLE_CHOICES
    ("all", _("All")),
) + DEFN_ROLE_CHOICES
MORPHEME_ROLE_CHOICES = [
    # Translators: This is a choice option that probably represents nothing, don't translate if not needed to.
    ("", _("---------"))
] + build_choice_list("MorphologyType")
ATTRS_FOR_FORMS = {"class": "form-control"}


class GlossSearchForm(forms.ModelForm):
    # Translators: GlossSearchForm label
    dataset = forms.ModelMultipleChoiceField(label=_("Dataset"), queryset=Dataset.objects.all(), required=False)
    # Translators: GlossSearchForm label
    signlanguage = forms.ModelMultipleChoiceField(label=_("Sign language"), queryset=SignLanguage.objects.all())
    # Translators: GlossSearchForm label
    search = forms.CharField(label=_("Gloss"))
    # Translators: GlossSearchForm label
    idgloss_en = forms.CharField(label=_("Gloss in English"))
    # Translators: GlossSearchForm label
    keyword = forms.CharField(label=_("Translations"))
    # Translators: GlossSearchForm label