django - Twitter bootstrap 和脆皮形式困惑

标签 django twitter-bootstrap django-crispy-forms

我决定将 twitter bootstrap 用于我想要制作的潜在网站。然而,我仍在学习网络开发。我想知道是否有人可以给我解释脆皮表格所提供的功能。我一直在阅读,我相信它嵌入了 twitter bootstrap?我想知道哪个是更好的选择。这可能是一个不好的问题,但我很困惑。选择哪一个都有优点和缺点吗?

最佳答案

Twitter bootstrap 与 crispy-forms 完全不同:

Twitter bootstrap 是一个 CSS 和 Javascript 演示框架。您可以使用它从任何框架生成 html 页面,而不仅仅是 Django!您可以使用它来定义 html 在网格中的布局方式,并且它还具有许多 html 组件的样式。

Crispy-forms 是一个 Django 应用程序,可用于创建更好的表单布局。它的作用是,您可以通过编程方式定义您希望如何呈现表单(而不是在模板中使用 html 进行渲染)。如果您想拥有非常漂亮的表单而没有太多麻烦,则应该使用它。

两者之间的唯一关系是,crispy-forms 实际上可以使用 bootstrap 布局来渲染表单,这意味着渲染的 html 表单的样式和类等将遵循 bootstrap 框架的概念。我从这里复制http://django-crispy-forms.readthedocs.org/en/latest/install.html#template-packs :

Since version 1.1.0 of django-crispy-forms has built-in support for different CSS frameworks, known as template packs within django-crispy-forms:

* bootstrap Bootstrap is crispy-forms’s default template pack, version 2 of the popular simple and flexible HTML, CSS, and Javascript for user interfaces from Twitter.
* bootstrap3 Twitter Bootstrap version 3.
* uni-form Uni-form is a nice looking, well structured, highly customizable, accessible and usable forms.
* foundation Foundation In creators words “The most advanced responsive front-end framework in the world”. This template pack is externally available through crispy-forms-foundation

因此,crispy-forms 可以使用 bootstrap 模式来渲染您的表单 - 但您必须已经在 django 模板中使用 bootstrap 才能正确显示!

关于django - Twitter bootstrap 和脆皮形式困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18631987/

相关文章:

python - 登录或匿名用户的 django 单元测试

python - Django 和 ManyToMany 字段

javascript - Bootstrap - 如何在子菜单打开时保持下拉菜单打开

python - 错误 'cmsplugin_filer_image' (django1.8)

python - 如何使用django filter icontains获取多个字段

django - django 脆皮表单和 bootstrap 3 中的字段对齐?

python - Django Crispy Multichoices Form (Foreignkey) 正在打印 "Object"而不是 Object.name

javascript - django CSS : general query on CDNs and crispy forms

jquery - Bootstrap 列无法正常工作

html - 无法更改导航栏的字体颜色