python类Layout()的实例源码

forms.py 文件源码 项目:gwells 作者: bcgov 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.layout = Layout(
            Fieldset(
                'Filter Pack',
                Div(
                    Div(AppendedText('filter_pack_from', 'ft'), css_class='col-md-2'),
                    Div(AppendedText('filter_pack_to', 'ft'), css_class='col-md-2'),
                    Div(AppendedText('filter_pack_thickness', 'in'), css_class='col-md-2'),
                    css_class='row',
                ),
                Div(
                    Div('filter_pack_material', css_class='col-md-3'),
                    Div('filter_pack_material_size', css_class='col-md-3'),
                    css_class='row',
                ),
            )
        )
        super(ActivitySubmissionFilterPackForm, self).__init__(*args, **kwargs)
forms.py 文件源码 项目:gwells 作者: bcgov 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.layout = Layout(
            Fieldset(
                'Well Development',
                Div(
                    Div('development_method', css_class='col-md-3'),
                    css_class='row',
                ),
                Div(
                    Div(AppendedText('development_hours', 'hrs'), css_class='col-md-3'),
                    css_class='row',
                ),
                Div(
                    Div('development_notes', css_class='col-md-6'),
                    css_class='row',
                ),
            )
        )
        super(ActivitySubmissionDevelopmentForm, self).__init__(*args, **kwargs)
forms.py 文件源码 项目:gwells 作者: bcgov 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.layout = Layout(
            Fieldset(
                'Water Quality',
                Div(
                    Div('water_quality_characteristics', css_class='col-md-3'),
                    css_class='row',
                ),
                Div(
                    Div('water_quality_colour', css_class='col-md-3'),
                    css_class='row',
                ),
                Div(
                    Div('water_quality_odour', css_class='col-md-3'),
                    css_class='row',
                ),
            )
        )

        super(ActivitySubmissionWaterQualityForm, self).__init__(*args, **kwargs)
forms.py 文件源码 项目:gwells 作者: bcgov 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.layout = Layout(
            Fieldset(
                'General Comments',
                Div(
                    Div('comments', css_class='col-md-12'),
                    css_class='row',
                ),
                Div(
                    Div('alternative_specs_submitted', css_class='col-md-12'),
                    css_class='row',
                ),
                Div(
                    Div(HTML('<p style="font-style: italic;">Declaration: By submitting this well construction, alteration or decommission report, as the case may be, I declare that it has been done in accordance with the requirements of the Water Sustainability Act and the Groundwater Protection Regulation.</p>'), css_class='col-md-12'),
                    css_class='row',
                ),
            )
        )
        super(ActivitySubmissionCommentForm, self).__init__(*args, **kwargs)
views.py 文件源码 项目:studentsdb 作者: PyDev777 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(CustAuthForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.form_action = reverse('users:auth_login')
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-sm-3'
        self.helper.field_class = 'col-sm-9'
        self.helper.error_text_inline = False
        self.helper.layout = Layout(
            Hidden('next', value=reverse('home')),
            Fieldset('', 'username', 'password',
                     HTML(u'<strong><a href="%s" class="btn btn-link col-sm-offset-3 modal-link">%s</a></strong>' % (reverse('password_reset'), _(u'Forgot your password?'))),
                     'captcha'),
            ButtonHolder(Submit('submit_button', _(u'Log in')),
                         Button('cancel_button', _(u'Cancel'), css_class='btn-default')))
views.py 文件源码 项目:studentsdb 作者: PyDev777 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(CustPswResetForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.form_action = reverse('password_reset')
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-md-3'
        self.helper.field_class = 'col-md-9'
        self.helper.error_text_inline = False
        self.helper.add_input(Submit('submit_button', _(u'Confirm')))
        self.helper.add_input(Button('cancel_button', _(u'Cancel'), css_class='btn-default'))

        # self.helper.layout = Layout(
        #     # Hidden('next', value=reverse('home')),
        #     HTML(u"<p>%s</p>" % _(u"Forgot your password? Enter your email in the form below and we'll send you instructions for creating a new one.")),
        #     Fieldset('', 'email', 'captcha'),
        #     ButtonHolder(Submit('submit_button', _(u'Confirm')),
        #                  Button('cancel_button', _(u'Cancel'), css_class='btn-default')))
students.py 文件源码 项目:studentsdb 作者: PyDev777 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(StudentUpdateForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.form_class = 'form-horizontal'
        self.helper.form_method = 'POST'
        self.helper.form_action = reverse('students_edit', kwargs={'pk': kwargs['instance'].id})
        self.helper.help_text_inline = False
        self.helper.label_class = 'col-sm-4'
        self.helper.field_class = 'col-sm-7'
        self.helper.layout = Layout(
            Fieldset('', 'first_name', 'last_name', 'middle_name',
                     AppendedText('birthday', '<span class="glyphicon glyphicon-calendar"></span>'),
                     'photo', 'ticket', 'student_group', 'notes'),
            ButtonHolder(
                Submit('save_button', _(u'Save')),
                Button('cancel_button', _(u'Cancel'), css_class='btn-default')))
students.py 文件源码 项目:studentsdb 作者: PyDev777 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(StudentAddForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.form_class = 'form-horizontal'
        self.helper.form_method = 'POST'
        self.helper.form_action = reverse('students_add')
        self.helper.help_text_inline = False
        self.helper.label_class = 'col-sm-4'
        self.helper.field_class = 'col-sm-7'
        self.helper.layout = Layout(
            Fieldset('', 'first_name', 'last_name', 'middle_name',
                     AppendedText('birthday', '<span class="glyphicon glyphicon-calendar"></span>'),
                     'photo', 'ticket', 'student_group', 'notes'),
            ButtonHolder(
                Submit('save_button', _(u'Save')),
                Button('cancel_button', _(u'Cancel'), css_class='btn-default')))
views.py 文件源码 项目:flowcelltool 作者: bihealth 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get_context_data(self, pk, **kwargs):
        context = super().get_context_data(**kwargs)
        self.object = models.FlowCell.objects.get(pk=pk)  # noqa
        context['object'] = self.object
        context['formset'] = kwargs['formset']
        context['helper'] = FormHelper()
        context['helper'].layout = Layout(
            Field('name', css_class='form-control-sm'),
            Field('reference', css_class='form-control-sm'),
            Field('barcode_set',
                  css_class='barcode-set-field form-control-sm'),
            Field('barcode', css_class='barcode-field form-control-sm'),
            Field('barcode_set2',
                  css_class='barcode-set-field2 form-control-sm'),
            Field('barcode2', css_class='barcode-field2 form-control-sm'),
            Field('lane_numbers', css_class='form-control-sm'),
        )
        context['helper'].form_tag = False
        context['helper'].template = \
            'bootstrap4/table_inline_formset.html'
        return context
views.py 文件源码 项目:studentsdb2 作者: trivvet 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(RegistrationForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        # set form tag attributes
        self.helper.action = reverse('registration_register')
        self.helper.form_method = 'POST'
        self.helper.form_class = 'form-horizontal'

        # set form field properties
        self.helper.help_text_inline = True
        self.helper.html5_required = True
        self.helper.attrs = {'novalidate': ''}
        self.helper.label_class = 'col-sm-4 control-label'
        self.helper.field_class = 'col-sm-8'

        # add buttons
        self.helper.layout.append(Layout(
            FormActions(
                Submit('register_button', _(u'Register')),
                Submit('cancel_button', _(u'Cancel'), css_class='btn-link')
            )
        ))
logs.py 文件源码 项目:studentsdb2 作者: trivvet 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(LogUpdateForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        # set form tag attributes
        self.helper.action = reverse_lazy('logs_edit', kwargs['instance'].id)
        self.helper.form_method = 'POST'
        self.helper.form_class = 'form-horizontal'

        # set form field properties
        self.helper.help_text_inline = True
        self.helper.html5_required = False
        self.helper.attrs = {'novalidate': ''}
        self.helper.label_class = 'col-sm-3 control-label'
        self.helper.field_class = 'col-sm-9'


        # add buttons
        self.helper.layout.append(Layout(
            FormActions(
                Submit('add_button', _(u'Save')),
                Submit('cancel_button', _(u'Cancel'), css_class='btn-link')
            )
        ))
groups.py 文件源码 项目:studentsdb2 作者: trivvet 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(GroupAddForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        # set form tag attributes
        self.helper.action = reverse('groups_add')
        self.helper.form_method = 'POST'
        self.helper.form_class = 'form-horizontal'

        # set form field properties
        self.helper.help_text_inline = True
        self.helper.html5_required = True
        self.helper.attrs = {'novalidate': ''}
        self.helper.label_class = 'col-sm-4 control-label'
        self.helper.field_class = 'col-sm-8'

        # add buttons
        self.helper.layout.append(Layout(
            FormActions(
                Submit('add_button', _(u'Add')),
                Submit('cancel_button', _(u'Cancel'), css_class='btn-link')
            )
        ))
forms.py 文件源码 项目:waves-demo 作者: lirmm 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(SignupForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.fields["email"].widget.input_type = "email"  # ugly hack
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-md-4 col-xs-4 hidden-sm hidden-xs'
        self.helper.field_class = 'col-md-8 col-xs-12'
        # self.helper.form_show_labels = False
        if 'bootstrap' in settings.CRISPY_TEMPLATE_PACK:
            email_field = PrependedText('email', '@', placeholder="Enter Email", autofocus="")
        else:
            email_field = Field('email', placeholder="Enter Email", autofocus="")
        self.helper.layout = Layout(
            email_field,
            Field('name', placeholder="Enter your full name"),
            Field('password1', placeholder="Enter Password"),
            Field('password2', placeholder="Confirm Password"),
            Field('register_for_api', placeholder="Register for our API access"),
            Field('country', placeholder="Select your country"),
            Field('institution', placeholder="Your institution"),
            Field('phone', placeholder="Phone"),
            Field('comment', placeholder="Any comment ?"),
            Field('tos', ),
            Submit('sign_up', 'Sign up', css_class="btn btn-lg btn-primary btn-block"),
        )
forms.py 文件源码 项目:della 作者: avinassh 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Fieldset(
                'Signup',
                'invite_code',
                'username',
                'email',
                'password1',
                'password2'
            )
        )
        self.helper.form_class = 'form-horizontal'
        self.helper.form_method = 'post'
        self.helper.form_action = 'user_manager:signup'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-10'
        self.helper.add_input(Reset('reset', 'Cancel'))
        self.helper.add_input(Submit('submit', 'Signup'))
forms.py 文件源码 项目:della 作者: avinassh 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Fieldset(
                'Request Account Activation Code',
                'email'
            )
        )
        self.helper.form_class = 'form-horizontal'
        self.helper.form_method = 'post'
        self.helper.form_action = 'user_manager:activate-request'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-10'
        self.helper.add_input(Reset('reset', 'Cancel'))
        self.helper.add_input(Submit('submit', 'Submit'))
forms.py 文件源码 项目:della 作者: avinassh 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # make description optional field
        self.fields['description'].required = False

        self.helper = FormHelper()
        self.helper.layout = Layout(
            Fieldset(
                'Upload Image',
                'title',
                'file',
                'description'
            )
        )
        self.helper.form_class = 'form-horizontal'
        self.helper.form_method = 'post'
        self.helper.form_action = 'gallery:upload'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-10'
        self.helper.add_input(Reset('reset', 'Cancel'))
        self.helper.add_input(Submit('submit', 'Submit'))
forms.py 文件源码 项目:lowfat 作者: softwaresaved 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(FundReviewForm, self).__init__(*args, **kwargs)

        self.helper.layout = Layout(
            Fieldset(
                '',
                "status",
                "funds_from_default",
                "grant_default",
                "required_blog_posts",
                PrependedText(
                    "budget_approved",
                    '£',
                    min=0.00,
                    step=0.01,
                    onblur="this.value = parseFloat(this.value).toFixed(2);"
                ),
                "notes_from_admin",
                "email",
                'not_send_email_field' if self.is_staff else None,
                'not_copy_email_field' if self.is_staff else None,
            )
        )

        self.helper.add_input(Submit('submit', 'Submit'))
forms.py 文件源码 项目:lowfat 作者: softwaresaved 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(BlogReviewForm, self).__init__(*args, **kwargs)

        self.helper.layout = Layout(
            Fieldset(
                '',
                'draft_url',
                'final',
                'status',
                'reviewer',
                'notes_from_admin',
                'published_url',
                'title',
                'tweet_url',
                'email',
                'not_send_email_field' if self.is_staff else None,
                'not_copy_email_field' if self.is_staff else None,
                ButtonHolder(
                    Submit('submit', 'Update')
                )
                )
            )
forms.py 文件源码 项目:MetaCI 作者: SalesforceFoundation 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, plan, repo, user, *args, **kwargs):
        self.plan = plan
        self.repo = repo
        self.user = user
        super(RunPlanForm, self).__init__(*args, **kwargs)
        self.fields['branch'].choices = self._get_branch_choices()
        self.helper = FormHelper()
        self.helper.form_class = 'form-vertical'
        self.helper.form_id = 'run-build-form'
        self.helper.form_method = 'post'
        self.helper.layout = Layout(
            Fieldset(
                'Choose the branch you want to build',
                Field('branch', css_class='slds-input'),
                css_class='slds-form-element',
            ),
            Fieldset(
                'Enter the commit you want to build.  The HEAD commit on the branch will be used if you do not specify a commit',
                Field('commit', css_class='slds-input'),
                css_class='slds-form-element',
            ),
            Fieldset(
                'Keep org? (scratch orgs only)',
                Field('keep_org', css_class='slds-checkbox'),
                css_class='slds-form-element',
            ),
            FormActions(
                Submit('submit', 'Submit',
                       css_class='slds-button slds-button--brand')
            ),
        )
forms.py 文件源码 项目:MetaCI 作者: SalesforceFoundation 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(AddRepositoryNotificationForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-vertical'
        self.helper.form_id = 'add-repository-notification-form'
        self.helper.form_method = 'post'
        self.helper.layout = Layout(
            Fieldset(
                'Select the repository you want to received notification for',
                Field('repo', css_class='slds-input'),
                Field('user', css_class='slds-input'),
                css_class='slds-form-element',
            ),
            Fieldset(
                'Select the build statuses that should trigger a notification',
                Field('on_success', css_class='slds-input'),
                Field('on_fail', css_class='slds-input'),
                Field('on_error', css_class='slds-input'),
                css_class='slds-form-element',
            ),
            FormActions(
                Submit(
                    'submit',
                    'Submit',
                    css_class='slds-button slds-button--brand',
                ),
            ),
        )


问题


面经


文章

微信
公众号

扫码关注公众号