コード例 #1
0
class AddPosgresViewAdminForm(forms.Form):
    name = forms.CharField(label="Nom",
                           required=True,
                           validators=[alphanumeric])

    status = forms.MultipleChoiceField(label="Statut",
                                       choices=tuple(
                                           x for x in Feature.STATUS_CHOICES),
                                       widget=forms.CheckboxSelectMultiple,
                                       required=False)
コード例 #2
0
class SearchForm(forms.Form):
    distance = forms.IntegerField(widget=forms.NumberInput(
        attrs={
            'class': 'hidden',
            'required': 'required'
        }))
    address = forms.CharField(widget=forms.TextInput(attrs={
        'class': 'hidden',
        'required': 'required'
    }))
    days = forms.IntegerField(widget=forms.NumberInput(attrs={
        'class': 'hidden',
        'required': 'required'
    }))
    event_types = forms.MultipleChoiceField(
        choices=Event.EVENT_TYPE_CHOICES,
        widget=CheckboxSelectMultipleULAttrs(
            ulattrs='class="list-unstyled hidden event-type-list"'))
コード例 #3
0
class DownloadForm(forms.ModelForm):
    choices = []
    try:
        choices = [[x.id, x] for x in Observatory.objects.all()]
    except:
        pass
    observatory_choices = forms.MultipleChoiceField(choices=choices)
    start_date = forms.DateTimeField(widget=DateInput())
    end_date = forms.DateTimeField(widget=DateInput())
    time_choices = (
        ('year', 'Year'),
        ('month', 'Month'),
        ('day', 'Day'),
        ('observation', 'Observation'),
    )
    time_frequency = forms.ChoiceField(choices=time_choices)

    class Meta(object):
        model = Observatory
        fields = []