forms.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目: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"),
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号