def __init__(self, *args, **kwargs): super(MemberChangeNameForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Fieldset( '', # Hide the legend of fieldset (HTML tag) 'last_name', 'first_name', ), HTML('<hr>'), ButtonHolder( Submit('submit', _('Change Your Name'), css_class='btn btn-lg btn-block btn-primary')), ) self.helper.form_method = 'POST'
def __init__(self, *args, **kwargs): super(SignupForm, self).__init__(*args, **kwargs) self.fields['dates'].widget = forms.CheckboxSelectMultiple() self.fields['roles'].widget = forms.CheckboxSelectMultiple() self.helper = FormHelper() self.helper.form_tag = False self.helper.layout = Layout( Field('full_name'), Field('email'), Field('github_nickname'), Field('company'), Field('dates', css_class="dates-attending"), Field('roles'), Field('give_a_talk', css_class='give_a_talk'), Field('talk_title', css_class='talk_title'), Field('comments'), )
def __init__(self, *args, **kwargs): super(UserRegisterForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.template_pack = 'bootstrap3' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-sm-2' self.helper.field_class = 'col-sm-8' self.helper self.helper.layout = Layout( 'username', 'email', 'email2', 'password', Submit('submit', 'Register'), )
def __init__(self, form, *args, **kwargs): super(MemberForm, self).__init__(*args, **kwargs) self.add_custom_fields(form) self.helper = FormHelper() self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-md-2' self.helper.field_class = 'col-md-10' layout_fields = [ Field('first_name', autofocus=True), 'last_name', 'birthday', ] + self.extra_keys + [ FormActions(Submit('save', _(u"Save"), css_class='btn-default'), ), ] self.helper.layout = Layout(*layout_fields)
def __init__(self, *args, **kwargs): super(GlucoseImportForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'post' self.helper.layout = Layout( MultiField( None, Fieldset( 'Instructions', HTML(''' To properly import your data, the CSV file must follow this order and format: <br><br> <ol> <li>Value</li> <li>Category (if no matching category in our system, 'No Category' will be assigned)</li> <li>Date (in m/d/yyyy format, e.g. 5/6/2014 or 05/06/2014)</li> <li> Time (in h:m am/pm format, e.g. 8:01 AM or 08:01 PM)</li> <li>Notes</li> </ol> <p>You can also download this template as a guide: <a href="{{ STATIC_URL }}samples/csv_import_template.csv"> csv_import_template.csv</a></p> <br> '''), ), HTML(''' {% if messages %} {% for message in messages %} <p {% if message.tags %} class="alert alert-{{ message.tags }}" {% endif %}>{{ message }}</p>{% endfor %}{% endif %} '''), Div( 'file', FormActions( Submit('submit', 'Import'), css_class='pull-right', ), css_class='well col-xs-10 col-sm-8 col-md-8', ), ), )
class SignupForm(auth_forms.UserCreationForm): def __init__(self, *args, **kwargs): super(SignupForm, self).__init__(*args, **kwargs) for fieldname in ['username', 'password1', 'password2']: self.fields[fieldname].help_text = None class Meta: model = User fields = ['username', 'email'] helper = FormHelper() helper.form_method = 'POST' helper.form_show_labels = False helper.layout = Layout( HTML('<h3 class="login-head"><i class="fa fa-lg fa-fw fa-user">' '</i>SIGN UP</h3>'), Div(Div(Field('username', css_class='form-control text-center', placeholder='Username'), css_class='col-md-12'), css_class='row mb-20'), Div(Div(Field('email', css_class='form-control text-center', placeholder='Email Address'), css_class='col-md-12'), css_class='row mb-20'), Div(Div(Field('password1', css_class='form-control text-center ', placeholder='Password'), css_class='col-md-12'), css_class='row mb-20'), Div(Div(Field('password2', css_class='form-control text-center ', placeholder='Confirm Password'), css_class='col-md-12'), css_class='row mb-20'), Div(FormActions( Submit('signup', 'SIGN UP', css_class='btn btn-primary btn-block')), css_class='form-group btn-container'), Div(Div( HTML('<br /><p class="semibold-text mb-0 text-center">' "<a href='{% url 'signin' %}'>Already Registered?</a></p>")), css_class='form-group'))
def __init__(self, *args, **kwargs): super(ThreatInputForm, self).__init__(*args, **kwargs) # If you pass FormHelper constructor a form instance # It builds a default layout with all its fields self.helper = FormHelper() self.helper.form_method = 'post' self.helper.form_class = 'form-horizontal col-xs-12 col-md-7 col-lg-6' self.helper.label_class = 'col-xs-4 col-md-4 col-lg-4' self.helper.field_class = 'col-xs-9 col-md-8 col-lg-8' self.helper.add_input(Submit('submit', '저장')) self.helper.add_input( Button('cancel', '취소', onclick='document.location.href="%s";' % reverse('risk:threat_list'))) # Remove the blank option from the select widget #self.fields['corp_name'].empty_label = None #self.fields['corp_name'].required = False self.helper.layout = Layout( HTML(''' {% if messages %} {% for message in messages %} <p {% if message.tags %} class="alert alert-{{ message.tags }}" {% endif %}>{{ message }}</p>{% endfor %}{% endif %} '''), Fieldset( Field('value', placeholder='Value', required=True, autofocus=True, min=0, step='any'), Field('threat_code', autofocus=True), 'category', 'actor', 'outcome', 'scenario', 'impact', 'frequency', widgets={'submit_button_type': forms.HiddenInput()}, ))
def __init__(self, *args, **kwargs): super(GameForm, self).__init__(*args, **kwargs) self.fields["name"].label = "Title" self.fields["year"].label = "Release year" self.fields["website"].help_text = ( "The official website (full address). If it doesn't exist, leave blank." ) self.fields["genres"].help_text = "" self.fields["description"].help_text = ( "Copy the official description of the game if you can find " "it. Don't write your own. For old games, check Mobygame's Ad " "Blurbs, look for the English back cover text." ) self.fields["title_logo"] = CroppieField( options={ "viewport": {"width": 875, "height": 345}, "boundary": {"width": 875, "height": 345}, "showZoomer": True, } ) self.fields["title_logo"].label = "Upload an image" self.fields["title_logo"].help_text = ( "The banner should include the game's title. " "Please make sure that your banner doesn't rely on " "transparency as those won't be reflected in the final image" ) self.helper = FormHelper() self.helper.include_media = False self.helper.layout = Layout( Fieldset( None, "name", "year", "developer", "publisher", "website", "platforms", "genres", "description", Field("title_logo", template="includes/upload_button.html"), ), ButtonHolder(Submit("submit", "Submit")), )
def __init__(self, *args, **kwargs): super(UserSettingsForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'post' self.helper.form_class = 'form-horizontal col-xs-12 col-md-6 col-lg-6' self.helper.label_class = 'col-xs-4 col-md-4 col-lg-4' self.helper.field_class = 'col-xs-8 col-md-8 col-lg-8' self.helper.help_text_inline = False self. helper.layout = Layout( HTML(''' {% if messages %} {% for message in messages %} <p {% if message.tags %} class="alert alert-{{ message.tags }}"\ {% endif %}>{{ message }}</p>{% endfor %}{% endif %} </p> '''), Fieldset( 'Profile', Field('username', readonly=True), Field('email'), Field('first_name'), Field('last_name'), Field('time_zone'), ), Fieldset( 'Preferences', Field('glucose_unit'), Field('default_category'), ), Fieldset( 'Glucose Levels', Field('glucose_low'), Field('glucose_high'), Field('glucose_target_min'), Field('glucose_target_max'), ), FormActions( Submit('submit', 'Save'), Button('cancel', 'Cancel', onclick='location.href="%s";' \ % reverse('dashboard')), ), )
def __init__(self, *args, **kwargs): """Add crispy-forms helper and layout to form.""" super(ExerciseForm, self).__init__(*args, **kwargs) # add Crispy Forms foo self.helper = FormHelper() self.helper.form_id = 'id-ExerciseForm' self.helper.add_input(Submit('submit', 'Submit')) self.helper.layout = Layout( Fieldset( 'exercise form', Field( 'text', v_model='input', css_class='editor-input', ), ), )
def __init__(self, *args, **kwargs): super(WebhookCreateForm, self).__init__(*args, **kwargs) helper = self.helper = FormHelper() layout = helper.layout = Layout() layout.append(Field("name", placeholder="webhook for town-square")) layout.append( Field( "incoming_webhook_url", placeholder= "https://mattermost.gitlab.com/hooks/b5g6pyoqsjy88fa6kzn7xi1rzy", )) layout.append(FormActions(Submit("save", "Next"))) helper.form_show_labels = False helper.form_class = "form-horizontal" helper.field_class = "col-lg-8" helper.help_text_inline = True
def __init__(self, *args, **kwargs): super(PessoasEnvolvidasAgendaForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'post' self.helper.add_input(Submit('submit', 'gravar')) self.helper.add_input( Submit( 'cancel', 'Cancelar', css_class='btn-danger', formnovalidate='formnovalidate', )) self.helper.layout = Layout( Field('nome'), Field(PrependedText( 'telefone', '<i class="glyphicon glyphicon-earphone"></i>'), help_text='teste'), Field(PrependedText('email', '@')), Field('funcionario'))
def __init__(self, *args, **kwargs): super(AddItemForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_class = 'form-verical' self.helper.label_class = 'col-md-4' self.helper.field_class = 'col-md-8' self.helper.layout = Layout( Div('sm_name', css_class='col-md-4'), Div('sm_sex', css_class='col-md-4'), Div('sm_type', css_class='col-md-4'), FormActions( Button('cancel', 'Cancel'), Button('ok', 'Ok', css_id='add_item11'), # hidden=True, ) )
def __init__(self, *args, **kwargs): super(GroupCreateForm, self).__init__(*args, **kwargs) self.fields["group_name"].label = "Group Name :" self.fields["group_info"].label = "Group Info :" self.fields["group_name"].widget.attrs[ "placeholder"] = "Enter Group Name..." self.fields["group_info"].widget.attrs[ "placeholder"] = "Enter Group Info..." self.helper = FormHelper() self.helper.form_class = "form-horizontal form-class" self.helper.label_class = "form-group col-lg-2" self.helper.field_class = "input-class col-lg-10" self.helper.layout = Layout( "group_name", "group_info", Submit("submit", "Create", css_class="col-lg-2"))
def __init__(self, *args, **kwargs): super(QdjangoWidgetForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_tag = False self.helper.layout = Layout( Div( Div( 'widget_type', css_class='col-md-4' ), Div( 'name', css_class='col-md-8' ), css_class='row' ), 'body' )
def __init__(self, *args, **kwargs): super(WebhookCreateForm, self).__init__(*args, **kwargs) helper = self.helper = FormHelper() layout = helper.layout = Layout() layout.append(Field('name', placeholder='webhook for town-square')) layout.append( Field( 'incoming_webhook_url', placeholder= 'https://mattermost.gitlab.com/hooks/b5g6pyoqsjy88fa6kzn7xi1rzy' )) layout.append(FormActions(Submit('save', 'Next'))) helper.form_show_labels = False helper.form_class = 'form-horizontal' helper.field_class = 'col-lg-8' helper.help_text_inline = True
def __init__(self, *args, **kwargs): super(UserForm, self).__init__(*args, **kwargs) for field in self.fields.values(): field.required = True field.help_text = u"" self.helper = FormHelper() self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-md-3' self.helper.field_class = 'col-md-9' self.helper.layout = Layout( 'username', 'first_name', 'last_name', 'email', FormActions(Submit('save', _(u"Save"), css_class='btn-default'), ), )
def __init__(self, *args, **kwargs): super().__init__(*args, *kwargs) super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.template_pack = 'bootstrap4' self.helper.layout = Layout( Fieldset( '', Div('full_name', css_class="m-3"), Div('email', css_class="m-3"), Div('phone_number', css_class="m-3"), Div('street_address1', css_class="m-3"), Div('street_address2', css_class="m-3"), Div('town_or_city', css_class="m-3"), Div('county', css_class="m-3"), Div('postcode', css_class="m-3"), ))
def __init__(self, *args, **kwargs): self.request = kwargs.pop('request', None) self.object = kwargs.pop('object', None) super(DepartamentoForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Div( Div(Row(Div(Field('descripcion', css_class='col-md-3')), ), css_class='modal-body'), Div( Row(FormActions( smtSave(), btnCancel(), btnReset(), ), ), css_class='modal-footer', ), ), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Div('name'), Div('company_name'), Div( Div('phone', css_class='col-6'), Div('email', css_class='col-6'), css_class='row' ), Div('country'), Div('message'), Div( Submit('Submit', 'Submit', css_class='btn btn-outline-primary'), css_class='form-action-wrap text-center' ) )
class PlayerForm(forms.ModelForm): class Meta: model = Player fields = '__all__' widgets = {'birth_date': forms.DateInput(attrs={'type': 'date'})} helper = FormHelper() helper.form_tag = False helper.layout = Layout( Div('first_name', css_class='col-md-6'), Div('last_name', css_class='col-md-6'), Div('position', css_class='col-md-6'), Div('birth_date', css_class='col-md-6'), Div('weight', css_class='col-md-6'), Div('height', css_class='col-md-6'), Div('image', css_class='col-md-6'), Div('is_active', css_class='col-md-6'), )
def __init__(self, *args, **kwargs): self.request = kwargs.pop('request', None) self.object = kwargs.pop('object', None) super(NotasForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Row( Div(Field('descripcion', placeholder='Ingrese un la nota'), css_class='col-md-12'), ), Div( Row(FormActions( smtSave(), btnCancel(), btnReset(), ), ), css_class='modal-footer', ), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Set up crispy forms... self.helper = FormHelper() self.helper.form_id = 'demo_request_form' self.helper.layout = Layout( 'name', 'email', 'country', PrependedText('phone', '...'), Field('phone_code', type='hidden'), 'org', 'org_url' ) # Set mandatory fields... for i in ['name', 'email', 'country', 'phone', 'phone_code', 'org']: self.fields[i].required = True
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # set choices self._set_viewer_users_choices() self._set_viewer_user_groups_choices() self.helper = FormHelper(self) self.helper.form_tag = False self.helper.layout = Layout( HTML( _('Select viewers with \'view permission\' on project that can view layer:' )), Field('viewer_users', css_class='select2', style="width:100%;"), Field('user_groups_viewer', css_class='select2', style="width:100%;"), )
def __init__(self, *args, **kwargs): super(GlucoseInputForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'post' self.helper.form_class = 'form-horizontal col-xs-12 col-md-6 col-lg-5' self.helper.label_class = 'col-xs-3 col-md-2 col-lg-2' self.helper.field_class = 'col-xs-9 col-md-10 col-lg-10' self.helper.add_input(Submit('submit', 'Save')) self.helper.add_input(Button( 'cancel', 'Cancel', onclick='location.href="%s";' % \ reverse('dashboard'))) # Remove the blank option from the select widget. self.fields['category'].empty_label = None self.fields['category'].required = False # Specify which time formats are valid for this field. This setting is # necessary when using the bootstrap-datetimepicker widget as it # doesn't allow inputting of seconds. valid_time_formats = ['%H:%M', '%I:%M%p', '%I:%M %p'] self.fields['record_time'].input_formats = valid_time_formats self. helper.layout = Layout( HTML( ''' {% if messages %} {% for message in messages %} <p {% if message.tags %} class="alert alert-{{ message.tags }}" {% endif %}>{{ message }}</p>{% endfor %}{% endif %} ''' ), Field('value', placeholder='Value', required=True, autofocus=True, min=0, step='any'), 'category', 'record_date', 'record_time', 'notes', Field('tags', placeholder='e.g. fasting, sick, "after meal"'), Field('submit_button_type', type='hidden') )
def get_form(self, form_class=None): form = super().get_form(form_class) form.helper = FormHelper() form.helper.show_form_errors = True form.helper.form_method = 'post' form.helper.form_action = 'cliente_cadastrar' form.helper.layout = Layout( Fieldset( 'Informações Pessoais', InlineRadios('tipo'), Field('nome', wrapper_class='form-group'), Field('profissao'), Field('nacionalidade'), Div( Div(Field('email', ), css_class="col-md-6"), Div(Field('telefone', ), css_class="col-md-3"), css_class="row", ), Div( Div(InlineRadios('sexo', ), css_class="col-md-4"), Div(Field('nascimento', ), css_class="col-md-4"), css_class="row", ), Div( Div(Field('pai', ), css_class="col-md-6"), Div(Field('mae', ), css_class="col-md-6"), css_class="row", ), Div( Div(Field('documento', ), css_class="col-md-4"), Div(Field('rg', ), css_class="col-md-4"), Div(Field('estado_civil', ), css_class="col-md-4"), css_class="row", ), Field("endereco")), HTML("<hr>"), Fieldset( 'Informações Bancárias', Field('banco'), Div(Div(Field('banco_conta', ), css_class="col-md-3"), Div(Field('banco_agencia', ), css_class="col-md-2"), Div(Field('banco_operacao', ), css_class="col-md-2"), css_class='row'), ), Submit("Enviar", 'Enviar')) return form
def __init__(self, *args, **kwargs): super(AssociationForm, self).__init__(*args, **kwargs) self.fields[ 'name'].help_text = u'<small class="help-error"></small> %s' % _( u' ') self.fields['solution'].required = True self.fields[ 'solution'].help_text = u'<small class="help-error"></small> %s' % _( u' ') self.fields[ 'logo'].help_text = u'<small class="help-error"></small> %s' % _( u'Available formats are JPG, GIF, and PNG.') self.helper = FormHelper() self.helper.form_method = 'post' self.helper.form_class = 'js-validate form-vertical' self.helper.layout = Layout( TabHolder( Tab( _('Association'), Row( Div(Field('name', css_class='input-required'), css_class='col-md-6'), Div(Field('type_a', css_class='input-required'), css_class='col-md-6'), ), Row( Div(Field('solution', css_class='input-required'), css_class='col-md-6'), ), ), Tab( _('Image'), Row(Div(Field('logo', css_class=''), css_class='col-md-6'), ), ), ), Row(FormActions( smtSave(), btnCancel(), btnReset(), ), ), )
def __init__(self, *args, **kwargs): self.request = kwargs.pop('request', None) self.object = kwargs.pop('object', None) super(RazaForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Row( Div(Field('nombre', placeholder='Ingrese un nombre', css_class='input-required'), css_class='col-md-3'), ), Div( Row(FormActions( smtSave(), btnCancel(), btnReset(), ), ), css_class='modal-footer', ), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['title'].label = "Todo Name" self.fields['description'].label = "Todo Description" self.fields['description'].widget = forms.Textarea(attrs={"rows": 5}) self.fields['description'].required = True self.helper = FormHelper() self.helper.form_method = "post" self.helper.layout = Layout( 'title', "description", "completed", HTML( '<a class="btn btn-danger" href="{% url \'todo:todos_list\' group_id %}"><i class="fa fa-md fa-times"></i> <span>Cancel</span></a>' ), HTML( '<button type="submit" class="btn btn-primary float-right"><i class="fa fa-md {{ submit_icon }}"></i> <span>{{ submit_value }}</span></a>' ), )
def __init__(self, *args, **kwargs): super(GroupForm, self).__init__(*args, **kwargs) self.fields[ 'name'].help_text = u'<small class="help-error"></small> %s' % _( u'Name of group the user or profile user.') #self.fields['name'].validators = [validate_unique_group_name] self.helper = FormHelper() self.helper.form_method = 'post' self.helper.form_class = 'js-validate form-vertical' self.helper.layout = Layout( Row( Div(Field('name', css_class='input-required'), css_class='col-md-8'), ), Row(FormActions( smtSave(), btnCancel(), btnReset(), ), ), )