forms.py 文件源码

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

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


问题


面经


文章

微信
公众号

扫码关注公众号