def __init__(self, *args, **kwargs): super(CollectionForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_class = 'form-horizontal' self.helper.layout = Layout() tab_holder = TabHolder() for fs in collection_fieldsets: # manually enforce field exclusion fs[1]['fields'] = [v for v in fs[1]['fields'] if v not in self.Meta.exclude] tab_holder.append(Tab(fs[1]['legend'], *fs[1]['fields'])) self.helper.layout.extend([tab_holder, Submit( 'submit','Save', css_class="btn-large offset2")])
def __init__(self, *args, **kwargs): super(UserEditForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-lg-2' self.helper.field_class = 'col-lg-8' self.helper.layout = Layout() tab_holder = TabHolder()
def __init__(self, *args, **kwargs): super(PipelineForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( TabHolder( Tab('Info', 'name', 'description', 'enabled'), Tab('Stages', 'stage1', 'stage2', 'stage3', 'stage4', 'stage5', 'stage6', 'stage7'), Tab('Variables', 'variable_sets', 'variables'), Tab('Ownership', 'owner_groups')))
class SampleForm(forms.Form): val1 = forms.CharField(required=False) val2 = forms.CharField(required=True) helper = FormHelper() helper.layout = Layout( TabHolder( Tab("one", "val1"), Tab("two", "val2"), ) )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( TabHolder( Tab('Info', 'name', 'description'), Tab('Variables', 'variables'), Tab('Ownership', 'owner_groups') ) )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( TabHolder( Tab('Info', 'name', 'description'), Tab('Access', 'username', 'password'), Tab('Ownership', 'owner_groups') ) )
class TestForm(forms.Form): val1 = forms.CharField(required=False) val2 = forms.CharField(required=True) helper = FormHelper() helper.layout = Layout( TabHolder( Tab('one', 'val1',), Tab('two', 'val2',) ) )
def __init__(self, *args, **kwargs): super(BatteryForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-lg-2' self.helper.field_class = 'col-lg-8' self.helper.layout = Layout() tab_holder = TabHolder() self.helper.add_input(Submit("submit", "Save"))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( TabHolder( Tab('Info', 'name'), Tab('Variables', 'variable_sets', 'variables'), Tab('Security', 'isolation_method', 'sudo_user', 'sudo_password')))
def __init__(self, *args, **kwargs): super(MirFuncForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( TabHolder( Tab('Using jobID', Field('jobID', css_class='form-control') ), Tab('Lolailo') ))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( TabHolder( Tab( 'Basic', Row( Column('amount', css_class='form-group col-md-6 col-sm-12'), Column('date', css_class='form-group col-md-6 col-sm-12'), ), 'description', 'category', Row( Column('recorded_by', css_class='form-group col-md-6 col-sm-12'), Column('reference', css_class='form-group col-md-6 col-sm-12'), )), Tab( 'Billing', 'billable', 'customer', ), Tab( 'Attachment', 'attachment', HTML(""" <div id='image-container' > <i class='fas fa-image fa-7x' id='image-placeholder'></i> <img id='attachment-preview' src='' alt='Attachment appears here.' /> </div> <script> function upload_img(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $('#attachment-preview').attr('src', e.target.result); } $('#image-placeholder').hide() $('#attachment-preview').show() reader.readAsDataURL(input.files[0]); } } $(document).ready(function(){ $('#id_attachment').attr({ 'onchange': 'upload_img(this)' }); }) </script> """)), )) self.helper.add_input(Submit('submit', 'Submit'))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( TabHolder( Tab('Info', 'project', 'status', 'revision', 'revision_username', 'queued_time', 'start_time', 'end_time', 'return_code'), Tab('Script', 'script'), Tab('Output', 'output', 'messages'), Tab('Debug', 'worker', 'working_dir', 'variables', 'launch_answers', 'output_variables', 'pipeline_parent_build_id', 'pipeline_origin_build_id') ) )
def __init__(self, *args, **kwargs): super(ClientBillForm, self).__init__(*args, **kwargs) self.helper.form_tag = False self.helper.layout = Layout(Div(TabHolder(Tab(_("Description"), Column("lead", "bill_id", "state", css_class="col-md-6"), Column("comment", "lang", "anonymize_profile", "include_timesheet", "bill_file", css_class="col-md-6"), ), Tab(_("Amounts"), Column("amount", "vat", "amount_with_vat", css_class="col-md-6")), Tab(_("Dates"), Column("creation_date", "due_date", "payment_date", "previous_year_bill", css_class="col-md-6"), ), css_class="row")))
def __init__(self, *args, **kwargs): super(TeamForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout() #self.helper.layout = Layout( # 'name', # 'team_image', # HTML("""{% if form.team_image.value %}<img class="img-responsive" src="/images/{{ form.team_image.value }}">{% endif %}""", )) tab_holder = TabHolder() self.helper.add_input(Submit("submit", "Save"))
def __init__(self, *args, **kwargs): super(OrderForm, self).__init__(*args, **kwargs) self.fields['due'].required = True self.helper = FormHelper() self.helper.layout = Layout( TabHolder( Tab('Basic', Row( Column('date', css_class='form group col-6'), Column('expected_receipt_date', css_class='form group col-6'), ), Row( Column('supplier', css_class='form group col-6'), Column('ship_to', css_class='form group col-6'), ), Row( Column('issuing_inventory_controller', css_class='col-6'), Column('supplier_invoice_number',css_class='col-6') ), 'due', 'tax', ), Tab('Shipping and Payment', Row( Column('bill_to', 'tracking_number', 'make_payment', css_class='col-6'), Column('notes', css_class='col-6'), )), ), HTML( """ <div id="order-root"></div> """ ), HTML(""" <div class="dropdown open"> <button class="btn btn-info dropdown-toggle" type="button" id="triggerId" data-toggle="dropdown" > Submit as... </button> <div class="dropdown-menu" aria-labelledby="triggerId"> <input class="dropdown-item" type="submit" name="status" value="draft"> <input class="dropdown-item" type="submit" name="status" value="order"> </div> """) )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( TabHolder( Tab('(Employees)', 'schedule', 'date', 'employees'), Tab('(Departments)', 'departments'), Tab('(Pay Grades)', 'pay_grades'), )) self.helper.add_input(Submit('submit', 'Submit'))
def __init__(self, *args, **kwargs): super(EmployeeVehicleForm, self).__init__(*args, **kwargs) for index, field in enumerate(self.fields): self.fields[field].widget.attrs.update({ 'class': 'form-control', 'tabindex': index + 1, }) for field in self.fields.values(): field.error_messages = {'required': ''} self.helper = FormHelper() self.helper.form_id = 'id_student_vehicle_form' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-md-2 col-md-offset-1' self.helper.field_class = 'col-md-4' self.helper.form_method = 'post' self.helper.form_action = '/vms/users/submit-vehicle-registration/' self.helper.layout = Layout( TabHolder( Tab( 'Personal Details', 'name', 'employee_no', 'department', 'date_of_birth', 'block_number', 'flat_number', 'mobile_number', 'user_photo', 'identity_card', 'parking_slot_no', ), Tab( 'Vehicle Details', 'vehicle_registration_number', 'color', 'make_and_model', 'chassis_number', 'engine_number', 'registered_in_the_name_of', 'vehicle_insurance_no', 'insurance_valid_upto', 'vehicle_registration_card', 'vehicle_insurance', 'vehicle_photo', ), Tab('Driving License', 'driving_license_number', 'driving_license_issue_date', 'driving_license_expiry_date', 'driving_license', 'declaration')), ButtonHolder( Submit('submit', 'Submit', css_class='btn-primary col-md-offset-5 form-submit')))
def __init__(self, *args, **kwargs): super(EquipmentForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( TabHolder( Tab( 'Main', Row( Column('name', 'unit_purchase_price', 'type', 'initial_quantity', css_class='col-md-6 col-sm-12 form-group'), Column('unit', 'description', css_class='col-md-6 col-sm-12 form-group'))), Tab( 'Details', Row( Column('length', css_class='form group col-md-4 col-sm-12'), Column('width', css_class='form group col-md-4 col-sm-12'), Column('height', css_class='form group col-md-4 col-sm-12'), ), Row( Column('supplier', css_class='form group col-md-6 col-sm-12'), Column('warehouse', css_class='form group col-md-6 col-sm-12'), ), Row( Column('category', css_class='form group col-md-6 col-sm-12'), Column('image', css_class='form group col-md-6 col-sm-12'), ), ), Tab( 'Asset', 'record_as_asset', 'asset_category', Row( Column('initial_value', css_class="col-md-6 col-sm-12"), Column('salvage_value', css_class="col-md-6 col-sm-12"), ), Row( Column('date_purchased', css_class="col-md-6 col-sm-12"), Column('depreciation_period', css_class="col-md-6 col-sm-12"), ), 'active')), Submit('submit', 'Submit'))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( TabHolder( Tab('Info', 'name'), Tab('Variables', 'variable_sets', 'variables'), Tab('Autoscaling', 'autoscaling_enabled', 'planner', 'minimum', 'maximum', 'running_weight', 'queued_weight', 'excess', 'multiplier', 'reevaluate_minutes', 'executor', 'executor_command'), Tab('Security', 'isolation_method', 'sudo_user', 'sudo_password') ) )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( TabHolder( Tab("Submission", *submission_options), Tab("Scoring", *scoring_options), Tab("Leaderboard", *leaderboard_options), Tab("Result Detail", *result_detail_options), ), ButtonHolder(Submit("save", "Save")), )
def __init__(self, *args, **kwargs): request = kwargs.pop('request', None) super(PageUpdateForm, self).__init__(*args, **kwargs) color_scheme_fields = self.init_color_scheme_switch() self.helper.layout = Layout( TabHolder( Tab(_('Main'), 'title', 'language', 'translation_of', 'parent', 'site', css_id='page-main'), Tab(_('Heading'), '_content_title', '_page_title', css_id='page-heading'), Tab( _('Publication'), 'active', 'featured', 'publication_date', 'publication_end_date', ), Tab(_('Navigation'), 'in_navigation', 'slug', 'override_url', 'redirect_to', 'symlinked_page', 'navigation_extension'), Tab(_('Theme'), 'template_key', 'layout', Fieldset('Themes', 'theme', *color_scheme_fields), css_id='page-theme-settings'), )) if request: _request = copy.copy(request) _request.POST = {} if kwargs.get('instance', None): page = kwargs['instance'] from .tables import PageDimensionTable table = PageDimensionTable(_request, page=page, data=page.dimensions, needs_form_wrapper=False) dimensions = Tab(_('Dimensions'), HTML(table.render()), css_id='page-dimensions') self.helper.layout[0].append(dimensions) self.fields['color_scheme'].required = False
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) #for key, field in self.fields.items(): # self.fields[key].widget.attrs.update({'class': 'form-control form-control-user'}) self.helper = FormHelper() self.helper.form_id = 'anuncianteForm' self.helper.form_class = 'mt-3 mb-3' self.helper.form_method = 'post' # atributo do form para funcionar o ajax do município self.helper.attrs = {'data-municipio-url': reverse('anuncio:carregar_municipio_estado')} # Fieldsets self.helper.layout = Layout( TabHolder( Tab( 'Principal', 'nome', 'tipo_pessoa', 'cpf_cnpj' ), Tab( 'Endereço', 'cep', 'logradouro', 'bairro', 'estado', 'cidade' ), Tab( 'Redes Sociais e Internet', 'email', 'instagram', 'facebook', 'youtube', 'site' ) ), FormActions( Submit('submit', 'Salvar'), Submit('cancel', 'Cancelar', css_class='btn-danger', formnovalidate='formnovalidate',) ) ) # Código abaixo faz parte dos procediemntos para viabilizar a escolha # dinâmica da cidade de acordo com o estado selecionado. self.fields['cidade'].queryset = Municipios.objects.none() if 'estado' in self.data: try: estado_id = int(self.data.get('estado')) self.fields['cidade'].queryset = Municipios.objects.filter(uf=estado_id) except (ValueError, TypeError): pass
def __init__(self, *args, **kwargs): super(WelcomeForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.field_class = 'form-horizontal' self.helper.form_method = 'post' self.helper.form_id = 'welcome_form' self.helper.attrs = {'onsubmit': 'disable_button()'} self.helper.layout = Layout( Fieldset( '请填写以下表格', TabHolder( Tab( '报名信息', AppendedText( 'name', '''<span class="glyphicon glyphicon-user"></span>''', placeholder='填写你的姓名'), InlineRadios('sex'), AppendedText( 'tel', '''<span class="glyphicon glyphicon-phone"></span>''', placeholder='填写你的手机号码'), AppendedText( 'qq', '''<span class="glyphicon glyphicon-envelope"></span>''', placeholder='选填,请输入qq号'), AppendedText( 'wechat', '''<span class="glyphicon glyphicon-envelope"></span>''', placeholder='选填,请输入微信号'), AppendedText( 'college', '''<span class="glyphicon glyphicon-book"></span>''', placeholder='“专业 学历 年级数字”,如“软件工程本科15”'), InlineRadios('dormitory'), InlineRadios('room'), InlineRadios('guanli'), InlineRadios('group1'), InlineRadios('group2'), Field( 'introduction', placeholder= '选填/可以说说你对舞社的想法、期待或者疑惑。这里集结华科最有实力的dancer,bboy,popper,locker。欢迎一切无论有基础还是无基础的huster加入ks大家庭' ), Field('captcha'), )), ), ButtonHolder(Submit('submit', '提交', css_class='button white'), ), ) if 'error_messages' not in kwargs: kwargs['error_messages'] = {} kwargs['error_messages'].update({'required': ugettext_lazy('不能为空哦~')})
def __init__(self, *args, **kwargs): super(RoundReportForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( TabHolder( Tab( "Pre-Round Information", "team", "match_number", "competition", "a_defense", "b_defense", "c_defense", "d_defense", HTML( "{% load staticfiles %}<img width='100%' src={% static 'Periodic-Table-of-the-Defenses.png' %}></img>" ), ), Tab( "During-Round Information", "a_defense_ability", "b_defense_ability", "c_defense_ability", "d_defense_ability", "boulders_scored_in_low", "boulders_scored_in_high", "can_scale_tower", "tower_scaling_ability", "tower_scaling_time", "low_boulders_blocked", "high_boulders_blocked", "notes_about_defense", ), Tab( "Post-Round Data", "friendly_alliance_score", "enemy_alliance_score", "friendly_alliance_rank_points", "enemy_alliance_rank_points", "foul_count", "technical_foul_count", "yellow_card_count", "red_card_count", "got_stuck", "lost_connection", "lost_control", "tech_issues_comment", "speed", "maneuverability", "pushing_power", "driveteam_maneuvering_skill", )), FormActions(Submit('save', 'Save'), ))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( TabHolder( Tab("Information", *information_items), Tab("Event", *event_items), Tab("Data", *data_items), Tab("Submissions", *submission_items), Tab("Publication", *publication_items), ), ButtonHolder(Submit("save", "Save")), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( TabHolder( Tab("Information", *common_information_items, "disclaimer"), Tab("Images", "banner", *common_images_items), Tab("Event", *event_items), Tab("Registration", *registration_items), Tab("Automated Evaluation", "use_evaluation", "use_teams"), ), ButtonHolder(Submit("save", "Save")), )
def __init__(self, *args, **kwargs): super(ProductForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( TabHolder( Tab( 'Main', Row( Column('name', Div('unit_purchase_price'), Div('tax'), css_class="form-group col-sm-6"), Column(HTML( "<div id='pricing-widget' style='margin:30px auto;'></div>" ), css_class="form-group col-sm-6"), ), 'type', # hidden field ), Tab( 'Details', 'description', 'unit', Row( Column(Div('initial_quantity'), css_class='form-group col-md-4 col-sm-12'), Column('minimum_order_level', css_class="form-group col-md-4 col-sm-12"), Column('maximum_stock_level', css_class="form-group col-md-4 col-sm-12"), ), Row( Column('length', css_class="form group col-md-4 col-sm-12"), Column('width', css_class="form group col-md-4 col-sm-12"), Column('height', css_class="form group col-md-4 col-sm-12"), ), Row( Column('supplier', css_class="form group col-md-6 col-sm-12"), Column('warehouse', css_class="form group col-md-6 col-sm-12"), ), Row( Column('category', css_class="form group col-md-6 col-sm-12"), Column('image', css_class="form group col-md-6 col-sm-12"), ), 'active'), ), Submit('submit', 'Submit'))
def __init__(self, *args, **kwargs): super(GFPForm, self).__init__(*args, **kwargs) self.fields['networkid'].label = "Network ID" self.fields['ppi'].label = "Protein-protein interaction database" self.fields['sm'].label = "Semantic similarity database" self.helper = FormHelper() self.helper.form_class = 'blueForms' self.helper.layout = Layout( \ Fieldset("Function inference algorithm", 'Algorithm'), \ Fieldset("Navigate network", \ TabHolder(Tab("Protein-protein interaction", 'ppi'), \ Tab("Co-expression", HTML(" <p><a href={% url 'gfps:experiments:annotation' %} class='btn'>Find a network ID</a></p>"), 'networkid'), \ Tab("Semantic similarity", 'sm'))), \ ButtonHolder(Submit('add', 'Add', css_class='btn-primary')))
def __init__(self, *args, **kwargs): self.action = kwargs.pop('action') if self.action == 'create': self.author = kwargs.pop('author') super(PostForm, self).__init__(*args, **kwargs) self.helper = FormHelper() lang_tabs = TabHolder() for lang in settings.LANGUAGES: lang_tabs.append(Tab( _(lang[1]), '_'.join(['title',lang[0]]), '_'.join(['post_text',lang[0]]), css_id = '_'.join(['post_tab',lang[0]]), ) ) self.helper.layout = Layout( Layout(lang_tabs), 'post_image', 'categories', 'is_published', Submit('save', _('Save')), HTML('''{% load i18n %}{% trans "or" %} <a href="#" onclick="window.history.go(-1);return false" >{% trans "Cancel" %}</a>''') )
class StudentForm(forms.ModelForm): """The modelform for the student model, using crispy forms""" helper = FormHelper() helper.layout = Layout( TabHolder( Tab( 'Basic Information', 'student_id', 'first_name', 'last_name', 'email', 'course', 'year', 'is_part_time', 'second_part_time_year', 'since', 'qld', 'tier_4', 'active', ), Tab( 'Contact Information', 'permanent_email', 'phone_number', 'cell_number', 'address', 'home_address' ), Tab( 'Other Information', 'lsp', 'notes', 'exam_id' ) ), FormActions( Submit('save', 'Save Student', css_class="btn btn-primary") ) ) helper.form_class = "form-horizontal" helper.label_class = "col-lg-2" helper.field_class = "col-lg-6 col-md-8 col-sm-10" class Meta: model = Student exclude = ['modules', 'nalp', 'achieved_degree', 'user'] error_messages = { 'student_id': {'required': NO_STUDENT_ID_ERROR} }
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( TabHolder( Tab( 'Basic Information', Field('project_code', css_class="col-md-3"), Field('name', wrapper_class="col-md-9"), Field('client', wrapper_class="col-md-3"), Field('description', wrapper_class="col-md-9"), Field('start_date', wrapper_class="col-md-6"), Field('expected_end_date', wrapper_class="col-md-6"), ), Tab(('Settings'), )))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( TabHolder( Tab( 'basic', 'name', 'manager', 'description', 'parent_department', ), Tab('members', 'employees'), )) self.helper.add_input(Submit('submit', 'Submit'))