當前位置: 首頁>>代碼示例>>Python>>正文


Python helper.FormHelper方法代碼示例

本文整理匯總了Python中crispy_forms.helper.FormHelper方法的典型用法代碼示例。如果您正苦於以下問題:Python helper.FormHelper方法的具體用法?Python helper.FormHelper怎麽用?Python helper.FormHelper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在crispy_forms.helper的用法示例。


在下文中一共展示了helper.FormHelper方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        self._email_token = kwargs.pop('email_token', None)
        self._verification_code = self._email_token.verification_code
        super(EmailVerificationForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'id_form_email_verification'
        self.helper.form_action = reverse_lazy('accounts_email_verification', args=(self._email_token.id,))
        self.helper.layout = Layout(
            Div(
                'code',
            ),
            HTML('''<hr class="full">'''),
            Div(
                Div(
                    HTML('''<a href="{% url 'accounts_register' %}">
                    {{ _('Cancel and sign up again') }}</a>&nbsp;&nbsp;'''),
                    Submit('submit', _('Verify Email address'), css_class='btn-success btn-lg'),
                    css_class='pull-right'
                )
            )
        ) 
開發者ID:pixlie,項目名稱:oxidizr,代碼行數:23,代碼來源:forms.py

示例2: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        super(KeywordCreateForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'id_form_keywords_create'
        self.helper.layout = Layout(
            Div(
                Div(
                    'term',
                    css_class='col-sm-6 col-sm-offset-3'
                ),
                css_class='row'
            ),
            HTML('''<hr class="full">'''),
            Div(
                Div(
                    HTML('''<a href="{% url 'keywords_manage' %}">{{ _('Cancel') }}</a>&nbsp;&nbsp;'''),
                    Submit('submit', _('Save'), css_class='btn-success btn-lg'),
                    css_class='pull-right'
                ),
                css_class='row',
            )
        ) 
開發者ID:pixlie,項目名稱:oxidizr,代碼行數:24,代碼來源:forms.py

示例3: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        AuthenticationForm.__init__(self, *args, **kwargs)
        self.error_messages['invalid_login'] = _(u"Пожалуйста, введите верные имя пользователя / адрес электронной почты  и пароль.")
        self.fields['username'].label = _(u"Логин / E-mail")

        self.helper = FormHelper(self)
        self.helper.form_action = '/accounts/login/'
        self.helper.label_class = 'col-md-4'
        self.helper.field_class = 'col-md-8'
        self.helper.layout.append(HTML(u"""<div class="form-group row" style="margin-bottom: 16px;margin-top: -16px;">
                                             <div class="col-md-offset-4 col-md-8">
                                               <a href="{% url "django.contrib.auth.views.password_reset" %}"><small class="text-muted">""" + _(u'Забыли пароль?') + """</small></a>
                                             </div>
                                           </div>
                                           <div class="form-group row">
                                             <div class="col-md-offset-4 col-md-8">
                                               <button type="submit" class="btn btn-secondary">""" + _(u'Войти') + """</button>
                                               <input type="hidden" name="next" value="{{ next }}" />
                                             </div>
                                           </div>""")) 
開發者ID:znick,項目名稱:anytask,代碼行數:22,代碼來源:__init__.py

示例4: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_action = reverse('tom_observations:add-existing')
        self.helper.layout = Layout(
            'target_id',
            'confirm',
            Row(
                Column(
                    'facility'
                ),
                Column(
                    'observation_id'
                ),
                Column(
                    ButtonHolder(
                        Submit('submit', 'Add Existing Observation')
                    )
                )
            )
        ) 
開發者ID:TOMToolkit,項目名稱:tom_base,代碼行數:23,代碼來源:forms.py

示例5: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        self.user = kwargs.pop("user")
        kwargs.update(
            {
                "initial": {
                    "contact_name": self.user.get_full_name,
                    "contact_email": self.user.email,
                }
            }
        )
        super(SponsorApplicationForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.field_class = "col-sm-10 col-lg-10"
        self.helper.form_tag = False
        self.helper.label_class = "col-sm-2 col-lg-2"
        self.helper.layout = Layout(
            "name",
            "external_url",
            "contact_name",
            "contact_email",
            "level",
        ) 
開發者ID:pydata,項目名稱:conf_site,代碼行數:25,代碼來源:forms.py

示例6: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):

        super(ActionItemForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.helper.layout = Layout(
            Row(
                Column(css_class='form-group col-md-3 col-xs-4'),
                Column('due_date', css_class='form-group col-md-3 col-xs-4'),
                Column('instruction', css_class='form-group col-md-3 col-xs-4'),
                css_class='form-row'
            ),
            Row(
                Column(css_class='form-group col-md-3 col-xs-4'),
                Column('comments', css_class='form-group col-md-6 col-xs-6')
            ),
            CustomCheckbox('priority'),
            Row(
                Column(Submit('submit', 'Submit'),
                    css_class='formgroup col-md-offset-3 col-xs-offset-4')
            )
        )

        self.fields['instruction'].queryset = models.ActionInstruction.objects.filter(
            active=True) 
開發者ID:SaturdayNeighborhoodHealthClinic,項目名稱:osler,代碼行數:27,代碼來源:forms.py

示例7: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        referral_location_qs = kwargs.pop('referral_location_qs', None)
        super(PatientContactForm, self).__init__(*args, **kwargs)
        if referral_location_qs is not None:
            self.fields['appointment_location'].queryset = referral_location_qs

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

        self.helper.add_input(Submit(
            self.SUCCESSFUL_REFERRAL,
            'Save & mark successful referral',
            css_class='btn btn-success'))
        self.helper.add_input(Submit(
            self.REQUEST_FOLLOWUP,
            'Save & request future followup',
            css_class='btn btn-info'))
        self.helper.add_input(Submit(
            self.UNSUCCESSFUL_REFERRAL,
            'Save & do not follow up again',
            css_class='btn btn-danger btn-sm')) 
開發者ID:SaturdayNeighborhoodHealthClinic,項目名稱:osler,代碼行數:25,代碼來源:forms.py

示例8: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        super(DemographicsForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_method = 'post'

        self.helper.layout = Layout(
                Fieldset('Medical',
                         'has_insurance',
                         'ER_visit_last_year',
                         'last_date_physician_visit',
                         'chronic_condition'),
                Fieldset('Social',
                         'lives_alone',
                         'dependents',
                         'resource_access',
                         'transportation'),
                Fieldset('Employment',
                         'currently_employed',
                         'education_level',
                         'work_status',
                         'annual_income')
        )

        self.helper.add_input(Submit('submit', 'Submit')) 
開發者ID:SaturdayNeighborhoodHealthClinic,項目名稱:osler,代碼行數:27,代碼來源:forms.py

示例9: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
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'),
        ) 
開發者ID:happinesspackets,項目名稱:happinesspackets,代碼行數:18,代碼來源:forms.py

示例10: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Row(
                Column('email', css_class='form-group col-md-6 mb-0'),
                Column('password', css_class='form-group col-md-6 mb-0'),
                css_class='form-row'
            ),
            'address_1',
            'address_2',
            Row(
                Column('city', css_class='form-group col-md-6 mb-0'),
                Column('state', css_class='form-group col-md-4 mb-0'),
                Column('zip_code', css_class='form-group col-md-2 mb-0'),
                css_class='form-row'
            ),
            'check_me_out',
            Submit('submit', 'Sign in')
        ) 
開發者ID:sibtc,項目名稱:advanced-crispy-forms-examples,代碼行數:22,代碼來源:forms.py

示例11: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        super(ReportIncidentForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()

        self.helper.form_action = reverse('tracker:report-incident')
        self.helper.render_hidden_fields = True
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-10'
        self.helper.add_input(Submit('submit', 'Report', css_class='btn-lg btn-block')) 
開發者ID:abarto,項目名稱:tracker_project,代碼行數:13,代碼來源:forms.py

示例12: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        super(EmailLoginForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.add_input(Submit('submit', _('Login'))) 
開發者ID:pythonkr,項目名稱:pyconkr-2015,代碼行數:7,代碼來源:forms.py

示例13: helper

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def helper(self):
        if not hasattr(self, '_helper'):
            self._helper = FormHelper()
            self._helper.error_text_inline = self.error_text_inline
            self._helper.form_action = self.get_form_action()
            self._helper.form_class = self.get_form_class()
            self._helper.form_method = self.get_form_method()

            for _input in self.get_form_inputs():
                self._helper.add_input(_input)

            self._helper.layout = self.get_layout(self._helper)

        return self._helper 
開發者ID:momosecurity,項目名稱:aswan,代碼行數:16,代碼來源:forms.py

示例14: __init__

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def __init__(self, *args, **kwargs):
        super(MainForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-inline'
        self.helper.field_template = 'bootstrap3/layout/inline_field.html'
        self.helper.form_show_labels = False
        self.helper.layout = Layout(
            'domain',
            CleanSubmitButton('submit', 'Search Data')
        ) 
開發者ID:opendata,項目名稱:lmgtdfy,代碼行數:12,代碼來源:forms.py

示例15: queue_page

# 需要導入模塊: from crispy_forms import helper [as 別名]
# 或者: from crispy_forms.helper import FormHelper [as 別名]
def queue_page(request, course_id):
    user = request.user
    course = get_object_or_404(Course, id=course_id)

    if not course.user_can_see_queue(user):
        raise PermissionDenied

    f = IssueFilter(request.GET, {})
    f.set_course(course, user)
    session_key = '_'.join([QUEUE_SESSION_PREFIX, str(course_id)])
    if request.GET:
        request.session[session_key] = f.form.data
    elif session_key in request.session:
        f.form.data = request.session.get(session_key)
    f.form.helper = FormHelper(f.form)
    f.form.helper.form_method = 'get'
    f.form.helper.layout.append(
        HTML(
            u"""
            <div class="form-group row">
            <button id="button_clear" class="btn btn-secondary" type="button">{0}</button>
            </div>
            <div class="form-group row">
            <button id="button_filter" class="btn btn-primary" type="button">{1}</button>
            </div>
            """.format(_(u'ochistit'), _(u'primenit'))
        )
    )

    schools = course.school_set.all()

    context = {
        'course': course,
        'user_is_teacher': course.user_is_teacher(user),
        'visible_attendance_log': course.user_can_see_attendance_log(user),
        'filter': f,
        'school': schools[0] if schools else '',
        'full_width_page': True,
        'timezone': user.profile.time_zone
    }
    return render(request, 'courses/queue.html', context) 
開發者ID:znick,項目名稱:anytask,代碼行數:43,代碼來源:views.py


注:本文中的crispy_forms.helper.FormHelper方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。