Python crispy_forms.layout 模块,Layout() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用crispy_forms.layout.Layout()

项目:MetaCI    作者:SalesforceFoundation    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(OrgLockForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-vertical'
        self.helper.form_id = 'org-lock-form'
        self.helper.form_method = 'post'
        self.helper.layout = Layout(
            FormActions(
                Submit(
                    'action',
                    'Cancel',
                    css_class='slds-button slds-button--neutral',
                ),
                Submit(
                    'action',
                    'Lock',
                    css_class='slds-button slds-button--destructive',
                ),
            ),
        )
项目:MetaCI    作者:SalesforceFoundation    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(OrgUnlockForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-vertical'
        self.helper.form_id = 'org-unlock-form'
        self.helper.form_method = 'post'
        self.helper.layout = Layout(
            FormActions(
                Submit(
                    'action',
                    'Cancel',
                    css_class='slds-button slds-button--neutral',
                ),
                Submit(
                    'action',
                    'Unlock',
                    css_class='slds-button slds-button--destructive',
                ),
            ),
        )
项目:MetaCI    作者:SalesforceFoundation    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(DeleteNotificationForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-vertical'
        self.helper.form_id = 'delete-notification-form'
        self.helper.form_method = 'post'
        self.helper.layout = Layout(
            FormActions(
                Submit(
                    'action',
                    'Cancel',
                    css_class='slds-button slds-button--neutral',
                ),
                Submit(
                    'action',
                    'Delete',
                    css_class='slds-button slds-button--destructive',
                ),
            ),
        )
项目:blogghar    作者:v1k45    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SignupForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.form_tag = False
        self.helper.form_show_labels = True

        for field in self.fields:
            self.fields[field].widget.attrs['placeholder'] = None
            del self.fields[field].widget.attrs['placeholder']

        self.helper.layout = Layout(
            'first_name', 'last_name', 'username', 'account_type',
            'email', 'password1', 'password2',
            StrictButton(
                'Sign Up', type='submit',
                css_class='btn purple btn-large waves-effect waves-light right'
            ),
        )
项目:blogghar    作者:v1k45    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(CustomLoginForm, self).__init__(*args, **kwargs)
        self.fields['password'].widget = forms.PasswordInput()
        self.helper = FormHelper(self)
        self.helper.col_class = False
        self.helper.form_tag = False
        self.helper.form_show_labels = True

        for field in self.fields:
            self.fields[field].widget.attrs['placeholder'] = None
            del self.fields[field].widget.attrs['placeholder']

        self.helper.layout = Layout(
            'login', 'password', 'remember',
            StrictButton(
                'Sign In', type='submit', style='margin-top: 10px',
                css_class="waves-effect btn-large blue waves-light btn right"),
        )
项目:blogghar    作者:v1k45    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(CustomChangePwdForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.form_tag = False
        self.helper.form_show_labels = True

        for field in self.fields:
            self.fields[field].widget.attrs['placeholder'] = None
            del self.fields[field].widget.attrs['placeholder']

        self.helper.layout = Layout(
            'oldpassword', 'password1', 'password2',
            StrictButton(
                'Change Password', type='submit', name='action',
                css_class='btn blue waves-effect waves-light btn-large')
        )
项目:blogghar    作者:v1k45    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(CustomResetPwdForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.form_tag = False
        self.helper.form_show_labels = True

        del self.fields['email'].widget.attrs['placeholder']
        self.fields['email'].label = "Email Address"

        self.helper.layout = Layout(
            'email',
            StrictButton(
                'Reset My Password', type='submit',
                css_class='btn blue btn-large waves-effect waves-light')
        )
项目:blogghar    作者:v1k45    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(CustomResetPasswordKeyForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.form_tag = False
        self.helper.form_show_labels = True
        for field in self.fields:
            self.fields[field].widget.attrs['placeholder'] = None
            del self.fields[field].widget.attrs['placeholder']

        self.helper.layout = Layout(
            'password1', 'password2',
            StrictButton(
                'Change Password', type='submit',
                css_class='btn blue btn-large waves-effect waves-light')
        )
项目:blogghar    作者:v1k45    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user')
        super(BlogForm, self).__init__(*args, **kwargs)

        # a little housekeeping
        self.fields['is_public'].label = 'Publicly visible'
        self.fields['short_description'].widget.attrs['class'] = 'materialize-textarea'  # noqa

        # making forms crispy
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            'title', 'tag_line', 'short_description', 'is_public',
            StrictButton(
                'Create a Blog', type='submit',
                css_class='btn blue btn-large right waves-effect waves-light'
            )
        )
项目:SpongeAuth    作者:lukegb    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        device = kwargs.pop('device')
        self.device = device

        signed_secret = kwargs.pop('secret', None)  # used for setup flow
        self.secret = signed_secret

        super().__init__(*args, **kwargs)

        self.helper = FormHelper()
        submit = Submit('submit', _('Log in'), css_class='pull-right')
        self.helper.layout = Layout(
            Field('response', autofocus='autofocus'),
            submit)

        if signed_secret:
            self.helper.layout.append(Hidden('secret', signed_secret))
            submit.value = _('Add authenticator')
项目:SpongeAuth    作者:lukegb    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field('username'),
            Field('password'),
            Field('email'),
            Field('mc_username'),
            Field('irc_nick'),
            Field('gh_username'),
            FormActions(
                HTML("""<a href="{{% url 'accounts:login' %}}" """
                     """class="btn btn-default">{}</a> """.format(
                         _("Log in"))),
                Submit('sign up', _("Sign up")),
                css_class="pull-right"
            )
        )
项目:SpongeAuth    作者:lukegb    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field('username'),
            HTML("""<i class="pull-right forgot-link">"""
                 """<a tabindex="-1" href="{{% url 'accounts:forgot' %}}">"""
                 """{}</a></i>""".format(_("Forgot your password?"))),
            Field('password'),
            HTML("""<div class="g-signin2 pull-left" """
                 """data-onsuccess="onGoogleSignIn" """
                 """data-theme="dark"></div>"""),
            FormActions(
                HTML("""<a href="{{% url 'accounts:register' %}}" """
                     """class="btn btn-default">{}</a> """.format(
                         _("Sign up"))),
                Submit('log in', _("Log in")),
                css_class="pull-right"
            )
        )
项目:postix    作者:c3cashdesk    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.form_id = 'create_user_form'
        self.helper.form_method = 'post'
        self.helper.form_action = reverse('backoffice:create-user')
        self.helper.add_input(Submit('submit', 'User anlegen'))
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'
        self.helper.layout = Layout(
            'username',
            'password',
            'firstname',
            'lastname',
            'is_backoffice_user',
            'is_troubleshooter',
        )
项目:DCRM    作者:82Flex    | 项目源码 | 文件源码
def helper(self):
        # As extra service, auto-adjust the layout based on the project settings.
        # This allows defining the top-row, and still get either 2 or 3 columns
        compact_fields = [name for name in self.fields.keys() if name in self.top_row_fields]
        other_fields = [name for name in self.fields.keys() if name not in self.top_row_fields]
        col_size = int(self.top_row_columns / len(compact_fields))
        col_class = self.top_column_class.format(size=col_size)

        compact_row = Row(*[Column(name, css_class=col_class) for name in compact_fields])

        # The fields are already ordered by the AbstractCommentForm.__init__ method.
        # See where the compact row should be.
        pos = list(self.fields.keys()).index(compact_fields[0])
        new_fields = other_fields
        new_fields.insert(pos, compact_row)

        helper = CompactLabelsCommentFormHelper()
        helper.layout = Layout(*new_fields)
        helper.add_input(SubmitButton())
        helper.add_input(PreviewButton())
        return helper
项目:xwingoverlayer    作者:sheepeatingtaz    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper()

        self.helper.form_id = 'main_form'
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-10'

        self.helper.layout = Layout(
            'player_name',
            'xws_file',
            FormActions(
                Submit('run', 'Import'),
            )
        )
项目:xwingoverlayer    作者:sheepeatingtaz    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper()

        self.helper.form_id = 'main_form'
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-3'
        self.helper.field_class = 'col-lg-8'

        self.helper.layout = Layout(
            Field(
                'squad_one',
                css_class="typeahead",
            ),
            Field(
                'squad_two',
                css_class="typeahead",
            ),
            'start_time',
            'match_minutes',
            FormActions(
                Submit('save', 'Create Match'),
            )
        )
项目:CommunityCellularManager    作者:facebookincubator    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SubscriberInfoForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'id-SubscriberInfoForm'
        self.helper.form_method = 'post'
        params = {
            'imsi': kwargs.get('initial').get('imsi')
        }
        self.helper.form_action = urlresolvers.reverse(
            'subscriber-edit', kwargs=params)
        # Hide the label for the sub vacuum prevention radio.
        self.fields['prevent_automatic_deactivation'].label = ''
        self.helper.layout = Layout(
            'imsi',
            'name',
            'prevent_automatic_deactivation',
            Submit('submit', 'Save', css_class='pull-right'),
        )
项目:CommunityCellularManager    作者:facebookincubator    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SubscriberCreditUpdateForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'id-SubscriberCreditUpdateForm'
        self.helper.form_method = 'post'
        params = {
            'imsi': kwargs.get('initial').get('imsi')
        }
        self.helper.form_action = urlresolvers.reverse(
            'subscriber-adjust-credit', kwargs=params)
        self.helper.form_class = 'col-xs-12 col-md-10 col-lg-8'
        self.helper.layout = Layout(
            'imsi',
            FieldWithButtons('amount',
                             StrictButton('Add', css_class='btn-default',
                                          type='submit')))
项目:CommunityCellularManager    作者:facebookincubator    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SubscriberSendSMSForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'id-SubscriberSendSMSForm'
        self.helper.form_method = 'post'
        params = {
            'imsi': kwargs.get('initial').get('imsi')
        }
        self.helper.form_action = urlresolvers.reverse('subscriber-send-sms',
                                                       kwargs=params)
        self.helper.form_class = 'col-xs-12 col-md-8 col-lg-6'
        self.helper.layout = Layout(
            'imsi',
            FieldWithButtons('message',
                             StrictButton('Send', css_class='btn-default',
                                          type='submit')))
项目:CommunityCellularManager    作者:facebookincubator    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SubVacuumForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'inactive-subscribers-form'
        self.helper.form_method = 'post'
        self.helper.form_action = '/dashboard/network/inactive-subscribers'
        # Render the inactive_days field differently depending on whether or
        # not this feature is active.
        if args[0]['sub_vacuum_enabled']:
            days_field = Field('inactive_days')
        else:
            days_field = Field('inactive_days', disabled=True)
        self.helper.layout = Layout(
            'sub_vacuum_enabled',
            days_field,
            Submit('submit', 'Save', css_class='pull-right'),
        )
项目:happinesspackets    作者:mxsasha    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(MessageRecipientForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-md-3'
        self.helper.field_class = 'col-md-8'

        self.fields['recipient_approved_public'].label = "I agree to publish this message and display it publicly in the Happiness Archive."
        self.fields['recipient_approved_public_named'].label = "... and I agree to display our names publicly too."
        self.fields['recipient_approved_public_named'].help_text = "Note: We only publish information if both the sender and the recipients agree."

        self.helper.layout = Layout(
            Fieldset("Privacy and permissions", 'recipient_approved_public', 'recipient_approved_public_named'),
            HTML("<br>"),
            Submit('submit', 'Save privacy choices', css_class='btn-lg centered'),
        )
项目:Django-Web-Development-with-Python    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(BulletinFilterForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "GET"

        self.helper.layout = layout.Layout(
            layout.Fieldset(
                _("Filter bulletins"),
                layout.Field("bulletin_type"),
                layout.Field("category"),
            ),
            bootstrap.FormActions(
                layout.Submit("submit", _("Filter")),
            ),
        )
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SponsorContactForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field("responded"),
            Field("companyName"),
            Field("contactEMail"),
            HTML("<p class=\"text-info\">Please ensure the correctness of the address. It will later be used in the billing process.</p>"),
            Field("street"),
            Field("zipcode"),
            Field("city"),
            Field("country"),
            Field("contactPersonFirstname"),
            Field("contactPersonSurname"),
            Field("contactPersonGender"),
            Field("contactPersonEmail"),
            Field("contactPersonLanguage"),
            Field("template"),
            Field("comment")
        )
        self.helper.add_input(Submit("Save", "Save"))
项目:django-danceschool    作者:django-danceschool    | 项目源码 | 文件源码
def __init__(self,*args,**kwargs):
        self._request = kwargs.pop('request',None)
        user = getattr(self._request,'user',None)
        payAtDoor = kwargs.pop('payAtDoor',False)

        super(PrivateLessonStudentInfoForm,self).__init__(*args,**kwargs)

        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_tag = False  # Our template must explicitly include the <form tag>

        if user and hasattr(user,'customer') and user.customer and not payAtDoor:
            # Input existing info for users who are logged in and have signed up before
            self.fields['firstName'].initial = user.customer.first_name or user.first_name
            self.fields['lastName'].initial = user.customer.last_name or user.last_name
            self.fields['email'].initial = user.customer.email or user.email
            self.fields['phone'].initial = user.customer.phone

        self.helper.layout = Layout(
            Div('firstName','lastName','email',css_class='form-inline'),
            Div('phone',css_class='form-inline'),
            Div('agreeToPolicies',css_class='card card-body bg-light'),
            Submit('submit',_('Complete Registration'))
        )
项目:cf-pretty-form-errors    作者:razortheory    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(PrettyFormPlaceholdersMixin, self).__init__(*args, **kwargs)
        helper = self.helper
        layout = helper.layout = Layout()

        for field_name in self.fields:
            field = self.fields[field_name]
            label = field.label if field.label else field_name.capitalize()

            layout.append(
                Field(
                    field_name,
                    placeholder= label + (' *' if field.required else ''),
                    template=helper.field_template, css_class='pretty_field'
                ),
            )
        helper.form_show_labels = False
项目:confrontiv    作者:correctiv    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        self.object = kwargs.pop('instance')

        super(InquiryResponseMixin, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'

        layout_elements = list(self.fields.keys())

        layout = layout_elements + [
            StrictButton(_(u'Send your response'),
                css_class='btn-success btn-lg', type='submit')
        ]
        self.helper.layout = Layout(*layout)
项目:ctf-manager    作者:BurningNetel    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(EventForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'
        self.helper.form_method = 'post'
        self.helper.form_action = 'newEvent'
        self.helper.layout = Layout(
            Field('name'),
            Field('date', placeholder='yyyy-mm-dd (h24-MM)'),
            HTML('<hr>'),
            Field('end_date', placeholder='yyyy-mm-dd (h24-MM)'),
            Field('description'),
            Field('url'),
            Field('username'),
            Field('password'),
            Field('location'),
            Field('min_score'),
            Field('max_score'),
            FormActions(
                Submit('save', 'Save')
            )
        )
项目:ctf-manager    作者:BurningNetel    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(ChallengeForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'
        self.helper.form_method = 'post'
        self.helper.layout = Layout(
            Field('name'),
            Field('points'),
            HTML('<hr>'),
            Field('flag'),
            FormActions(
                Submit('save', 'Save')
            )
        )
项目:gwells    作者:bcgov    | 项目源码 | 文件源码
def helper(self):
        helper = FormHelper()
        helper.form_id = 'id-searchForm'
        helper.form_method = 'get'
        helper.form_action = ''

        helper.layout = Layout(
            Fieldset(
                '',
                'well',
                'addr',
                'legal',
                'owner',
                # start_lat_long and end_lat_long are programatically generated
                # based on an identifyWells operation on the client.
                Hidden('start_lat_long', ''),
                Hidden('end_lat_long', ''),
            ),
            FormActions(
                Submit('s', 'Search', css_class='formButtons'),
                HTML('<a class="btn btn-default" id="reset-id-s" href="{% url \'search\' %}">Reset</a>'),
                )
        )

        return helper
项目:gwells    作者:bcgov    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.form_show_labels = False
        self.helper.render_required_fields = True
        self.helper.render_hidden_fields = True
        self.helper.layout = Layout(
            HTML('<tr valign="top">'),
            HTML('<td>'),
            'liner_perforation_from',
            HTML('</td>'),
            HTML('<td>'),
            'liner_perforation_to',
            HTML('</td><td width="75">&nbsp;{% if form.instance.pk %}{{ form.DELETE }}{% endif %}</td>'),
            HTML('</tr>'),
        )
        super(LinerPerforationForm, self).__init__(*args, **kwargs)
项目:gwells    作者:bcgov    | 项目源码 | 文件源码
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)
项目:gwells    作者:bcgov    | 项目源码 | 文件源码
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)
项目:gwells    作者:bcgov    | 项目源码 | 文件源码
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)
项目:gwells    作者:bcgov    | 项目源码 | 文件源码
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)
项目:studentsdb    作者:PyDev777    | 项目源码 | 文件源码
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')))
项目:studentsdb    作者:PyDev777    | 项目源码 | 文件源码
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')))
项目:studentsdb    作者:PyDev777    | 项目源码 | 文件源码
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')))
项目:studentsdb    作者:PyDev777    | 项目源码 | 文件源码
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')))
项目:flowcelltool    作者:bihealth    | 项目源码 | 文件源码
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
项目:studentsdb2    作者:trivvet    | 项目源码 | 文件源码
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')
            )
        ))
项目:studentsdb2    作者:trivvet    | 项目源码 | 文件源码
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')
            )
        ))
项目:studentsdb2    作者:trivvet    | 项目源码 | 文件源码
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')
            )
        ))
项目:waves-demo    作者:lirmm    | 项目源码 | 文件源码
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"),
        )
项目:della    作者:avinassh    | 项目源码 | 文件源码
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'))
项目:della    作者:avinassh    | 项目源码 | 文件源码
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'))
项目:della    作者:avinassh    | 项目源码 | 文件源码
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'))
项目:lowfat    作者:softwaresaved    | 项目源码 | 文件源码
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'))
项目:lowfat    作者:softwaresaved    | 项目源码 | 文件源码
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')
                )
                )
            )
项目:MetaCI    作者:SalesforceFoundation    | 项目源码 | 文件源码
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')
            ),
        )
项目:MetaCI    作者:SalesforceFoundation    | 项目源码 | 文件源码
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',
                ),
            ),
        )