html - Django 脆皮表格仅部分加载 css

标签 html css django django-forms django-crispy-forms

我正在尝试创建一个看起来像 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/

相关文章:

javascript - 通过js更改切换按钮

javascript - 使用 jQuery Chosen 时隐藏选择列表选项值

jquery - 使用 jquery 为数组元素设置动画

javascript - 翻译后将 html 元素返回到其原始位置

c# - 所有 Accordion 行同时打开,如何解决?

css - 如何在CSS Font Face中转换data :font to . ttf Font Format

python - Django UserCreationForm 自定义字段

python - 创建具有相同键的字典列表?

python - pinax.apps.accounts、idios 配置文件和 django.auth.User 之间的区别

javascript - 如何通过许多重复出现的图像来加快页面加载时间?