def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['name'] = forms.CharField( widget=forms.TextInput(attrs={'class': 'form-control'}), required=False ) self.fields['description'] = forms.CharField( widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 4, 'data-validation-optional': 'true'}), required=False ) self.fields['transport_type'] = forms.ModelChoiceField( required=False, widget=forms.Select( attrs={'class': 'selectpicker form-control border', 'data-live-search': 'true', 'data-validation': 'required'} ), queryset=TransType.objects.filter(parent__isnull=False), ) self.fields['tag'] = CustomTagsInputField( Tag.objects.filter(is_actived=True), create_missing=True, required=False, help_text='Add a tag' )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['username'] = forms.CharField( label='Username', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False ) self.fields['name'] = forms.CharField( label='Sequence Name', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False ) self.fields['camera_make'] = forms.CharField( label='Camera Make/Model', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False ) self.fields['transport_type'] = forms.ModelChoiceField( required=False, widget=forms.Select( attrs={'class': 'form-control'}), queryset=TransType.objects.all(), empty_label='All Types' ) self.fields['tag'] = CustomTagsInputField( Tag.objects.filter(is_actived=True), create_missing=False, required=False, )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['username'] = forms.CharField( label='Username', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False ) self.fields['name'] = forms.CharField( label='Tour Name', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False ) self.fields['tour_tag'] = CustomTagsInputField( TourTag.objects.filter(is_actived=True), create_missing=False, required=False, ) self.fields['tour_tag'].help_text = 'Search for a tag' self.fields['like'] = forms.ChoiceField( label='Like', widget=forms.RadioSelect(), required=False, choices=(('all', 'All'), ('true', 'Liked'), ('false', 'Unliked')), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['name'] = forms.CharField( label='Guidebook Name', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False) self.fields['image_key'] = forms.CharField( label='Image Key', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False) self.fields['category'] = forms.ModelChoiceField( required=False, widget=forms.Select(attrs={'class': 'form-control'}), queryset=Category.objects.all(), empty_label="All Categories") self.fields['tag'] = CustomTagsInputField( Tag.objects.filter(is_actived=True), create_missing=False, required=False, ) self.fields['username'] = forms.CharField( label='Username', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False)
class GuidebookForm(forms.ModelForm): name = forms.CharField( widget=forms.TextInput(attrs={ 'class': 'form-control', 'data-validation': 'required' }), required=False) description = forms.CharField( widget=forms.Textarea(attrs={ 'class': 'form-control', 'rows': 4, 'data-validation': 'required' }), required=False) category = forms.ModelChoiceField( required=False, widget=forms.Select(attrs={ 'class': 'form-control', 'data-validation': 'required' }), queryset=Category.objects.all(), to_field_name='pk', empty_label=None) tag = CustomTagsInputField( Tag.objects.filter(is_actived=True), create_missing=True, required=False, ) # cover_image = forms.FileField( # widget=forms.ClearableFileInput(attrs={'class': 'form-control', 'data-validation': 'required'}), # required=False # ) # is_published = forms.ChoiceField( # widget=forms.RadioSelect(attrs={'class': 'd-none', 'disabled': 'disabled'}), # choices=(('True', 'Published'), ('False', 'Unpublished')), # required=False, # label='' # ) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['tag'] = CustomTagsInputField( Tag.objects.filter(is_actived=True), create_missing=True, required=False, ) class Meta: model = Guidebook fields = ( 'name', 'description', # 'cover_image', 'category', 'tag', # 'is_published', )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['tag'] = CustomTagsInputField( Tag.objects.filter(is_actived=True), create_missing=True, required=False, help_text='Add for a tag')
class GuidebookForm(forms.ModelForm): name = forms.CharField( widget=forms.TextInput(attrs={ 'class': 'form-control', 'data-validation': 'required' }), required=False) description = forms.CharField( widget=forms.Textarea(attrs={ 'class': 'form-control', 'rows': 4, 'data-validation': 'required' }), required=False) category = forms.ModelChoiceField( required=False, widget=forms.Select( attrs={ 'class': 'selectpicker form-control border', 'data-live-search': 'true', 'data-validation': 'required' }), queryset=Category.objects.all(), to_field_name='pk', empty_label=None) tag = CustomTagsInputField(Tag.objects.filter(is_actived=True), create_missing=True, required=False, help_text='Add for a tag') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['tag'] = CustomTagsInputField( Tag.objects.filter(is_actived=True), create_missing=True, required=False, help_text='Add for a tag') class Meta: model = Guidebook fields = ( 'name', 'description', # 'cover_image', 'category', 'tag', # 'is_published', )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['name'] = forms.CharField( widget=forms.TextInput(attrs={'class': 'form-control', 'data-validation': 'required'}), required=False ) self.fields['description'] = forms.CharField( widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 4, 'data-validation': 'required'}), required=False ) self.fields['tour_tag'] = CustomTagsInputField( TourTag.objects.filter(is_actived=True), create_missing=True, required=False, ) self.fields['tour_tag'].help_text = 'Add a tag'
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['name'] = forms.CharField( label='Guidebook Name', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False) self.fields['image_key'] = forms.CharField( label='Image Key', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False) self.fields['category'] = forms.ChoiceField( required=False, widget=forms.Select( attrs={ 'class': 'selectpicker form-control border', 'data-live-search': 'true' }), choices=categories(), ) self.fields['tag'] = CustomTagsInputField( Tag.objects.filter(is_actived=True), create_missing=False, required=False, ) self.fields['tag'].help_text = 'Search for a tag' self.fields['username'] = forms.CharField( label='Username', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False) self.fields['like'] = forms.ChoiceField( label='Like', widget=forms.RadioSelect(), required=False, choices=(('all', 'All'), ('true', 'Liked'), ('false', 'Unliked')), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['name'] = forms.CharField( label='Sequence Name', widget=forms.TextInput(attrs={'class': 'form-control'}), required=False ) self.fields['camera_make'] = forms.MultipleChoiceField( required=False, widget=forms.SelectMultiple( attrs={'class': 'selectpicker form-control border', 'multiple': 'multiple', 'data-live-search': 'true'} ), choices=camera_makes(), label='Camera Make (leave blank for all)', ) self.fields['transport_type'] = forms.ChoiceField( required=False, widget=forms.Select( attrs={'class': 'selectpicker form-control border', 'data-live-search': 'true'} ), choices=transport_types, ) self.fields['tag'] = CustomTagsInputField( Tag.objects.filter(is_actived=True), create_missing=False, required=False, ) self.fields['tag'].help_text = 'Search for a tag' self.fields['start_time'] = forms.DateField( widget=DatePickerInput( format='YYYY-MM-DD', options={ "format": 'YYYY-MM-DD', "showClose": False, "showClear": False, "showTodayButton": False, }, ), required=False ) self.fields['end_time'] = forms.DateField( widget=DatePickerInput( format='YYYY-MM-DD', options={ "format": 'YYYY-MM-DD', "showClose": False, "showClear": False, "showTodayButton": False, }, attrs={ 'data-validation': 'end_time' } ), required=False ) self.fields['like'] = forms.ChoiceField( label='Like', widget=forms.RadioSelect(), required=False, choices=(('all', 'All'), ('true', 'Liked'), ('false', 'Unliked')), )