我正在尝试使用脆皮形式。我不确定 StrictButton
是从哪里导入的,如下所示(请参阅代码)给我一个错误:
NameError: 全局名称“StrictButton”未定义
如何解决?
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit
def __init__(self, *args, **kwargs):
super(CompanyUserCreationForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-3'
self.helper.field_class = 'col-lg-8'
self.helper.layout = Layout(
'email',
'password',
'remember_me',
StrictButton('Register', css_class='btn-default'),
)
像这样导入 StrictButton 元素...
from crispy_forms.bootstrap import StrictButton
我是一名优秀的程序员,十分优秀!