我正在尝试创建一个看起来像 this 的脆皮表格,但我的代码呈现默认的 html 输入框和不相交的 Bootstrap 按钮,而不是所需的“连接”表单。我的表单代码类似于:
class SearchForm(forms.Form):
query = forms.CharField()
def __init__(self, *args, **kwargs):
super(SearchForm, self).__init__(*args, **kwargs)
self.fields['query'].label = ""
self.helper = FormHelper(self)
self.helper.layout = Layout(
FieldWithButtons('query', StrictButton(">>", type="submit", css_class="btn-success"), css_class='input-xlarge')
)
self.helper.form_tag = False
它创建了一个看起来像 this 的东西.我该如何解决这个问题?
最佳答案
看起来您需要 Bootstrap。根据 this documentation,尝试在 settings.py
中设置 CRISPY_TEMPLATE_PACK = 'bootstrap'
(或 bootstrap3
) .
关于html - Django 脆皮表格仅部分加载 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19484092/