Twitter引导和脆弱的形式混乱

时间:2013-09-05 08:58:59

标签: django twitter-bootstrap django-crispy-forms

我决定使用twitter bootstrap来建立一个我想要的潜在网站。但是,我仍然在学习Web开发。我想知道是否有人可以给我并解释Crispy表格提供的内容。我一直在阅读,我相信它内嵌了twitter引导程序?我想知道哪个是更好的选择。这可能是个问题,但我很困惑。选择是否有利有弊?

1 个答案:

答案 0 :(得分:5)

Twitter引导程序与脆弱形式完全不同:

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可以使用引导模式来呈现你的表单 - 但是你必须在你的django模板中使用bootstrap 已经才能正常显示!