Python crispy_forms.helper 模块,FormHelper() 实例源码

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

项目: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'
            )
        )
项目:blogghar    作者:v1k45    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user')
        super(PostForm, self).__init__(*args, **kwargs)
        self.fields['slug'].required = False
        self.fields['slug'].label = 'Slug (leave blank to auto-generate)'
        self.fields['cover'].label = 'Post cover (optional)'
        self.fields['content'].label = ''
        # making forms crispy
        self.helper = FormHelper(self)
        self.helper.include_media = False
        self.helper.add_input(Submit(
            'draft', 'draft',
            css_class='btn orange btn-large right waves-effect waves-light'))
        self.helper.add_input(Submit(
            'publish', 'publish',
            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',
        )
项目: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'),
            )
        )
项目:sturdy-potato    作者:FlowFX    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        """Initiate form with Crispy Form's FormHelper."""
        super(AddressForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()

        self.helper.add_input(Submit('submit', 'Submit'))

        self.helper.layout = Layout(
            Fieldset(
                'An address',
                Field(
                    'street',
                    autofocus=True,
                ),
                'postal_code',
                Field('place', placeholder='Wait for it.'),
                Field('municipality', readonly='true', placeholder='Will be filled automatically.'),
                Field('city', readonly='true', placeholder='Will be filled automatically.'),
                Field('state', readonly='true', placeholder='Will be filled automatically.'),
            ),
        )

        self.fields['place'].required = True
        self.fields['street'].required = True
        self.fields['postal_code'].required = True
项目: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")),
            ),
        )
项目: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.helper = FormHelper()
        self.helper.add_input(Submit('submit', _('Submit')))
        user = kwargs.pop('user', None)

        if hasattr(user,'id'):
            kwargs.update(initial={
                'submissionUser': user.id
            })
        super(RevenueReportingForm,self).__init__(*args,**kwargs)
        self.fields['submissionUser'].widget = forms.HiddenInput()
        self.fields['invoiceNumber'].widget = forms.HiddenInput()
        self.fields["invoiceItem"] = InvoiceItemChoiceField(queryset=InvoiceItem.objects.none(),required=False)

        # re-order fields to put the associateWith RadioSelect first.
        newFields = OrderedDict()
        newFields['associateWith'] = self.fields['associateWith']
        for key,field in self.fields.items():
            if key not in ['associateWith']:
                newFields[key] = field
        self.fields = newFields
项目: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'))
        )
项目: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(CustPswChangeForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.form_action = reverse('password_change')
        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'))


# def custom_activation_complete(request):
#     print 'custom_activation_complete'
#     return render(request, 'registration/activation_complete.html', {})
项目: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.BarcodeSet.objects.get(pk=pk)  # noqa
        context['object'] = self.object
        context['formset'] = kwargs['formset']
        context['helper'] = FormHelper()
        context['helper'].form_tag = False
        context['helper'].template = \
            'bootstrap4/table_inline_formset.html'
        return context


# FlowCell Views --------------------------------------------------------------


#: All fields for the flow cell
项目: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(ContactForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()

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

        # 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-2 control-label'
        self.helper.field_class = 'col-sm-10'


        # add buttons
        self.helper.add_input(Submit('send_button', _(u'Submit')))
项目: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"),
        )
项目:nav    作者:UNINETT    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(ViewForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'custom'
        self.helper.form_action = ''
        self.helper.form_method = 'GET'
        self.helper.layout = Layout(
            Fieldset(
                'Choose statistic',
                Row(
                    Column('view', css_class='medium-5'),
                    Column('timeframe', css_class='medium-3'),
                    Column('rows', css_class='medium-1'),
                    Column(LabelSubmit('submit', 'Show statistics',
                                       css_class='postfix'),
                           css_class='medium-3'),
                )
            )
        )
项目:nav    作者:UNINETT    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(AccountLogSearchForm, self).__init__(*args, **kwargs)
        css_class_large = 'large-4 medium-6'
        css_class_small = 'large-2 medium-6'
        self.helper = FormHelper()
        self.helper.form_action = ''
        self.helper.form_method = 'GET'
        self.helper.form_class = 'custom'
        self.helper.layout = Layout(
            Row(
                Column('query', css_class=css_class_large),
                Column('time', css_class=css_class_large),
                Column('port_type', css_class=css_class_small),
                Column('dns_lookup', css_class=css_class_small),
            ),
            Submit('send', 'Search', css_class='small')
        )
项目:nav    作者:UNINETT    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(JustificationForm, self).__init__(*args, **kwargs)

        # Set correct helper text based on if this is an edit or add
        submit_value = 'Add reason'
        fieldset_legend = 'Add detention reason'
        if self.initial.get('justificationid'):
            submit_value = 'Save changes'
            fieldset_legend = 'Edit detention reason'

        # Create helper for crispy layout
        self.helper = FormHelper()
        self.helper.form_action = 'arnold-justificatons'
        self.helper.layout = Layout(
            Fieldset(
                fieldset_legend,
                'name', 'description', 'justificationid'
            ),
            Submit('submit', submit_value, css_class='small')
        )