控制模板sans-bs中的小部件。
django_reform的Python项目详细描述
控制模板sans-bs中的小部件。
安装
我们在芝士店:
pip install django_reform
用法
在项目中使用django_改革:
将其包含在您的设置文件中已安装的应用程序中。
将您的表单呈现为这样:
{% load reform %} {{ reform form }}
打开reform/templates/reform/field.html-默认情况下呈现HTML5输入类型。继续调整:
{% load widget_tweaks reform %} {% with field_type=field|get_form_field_type %} {% if field_type == 'DateField' %} {% render_field field type="date" %} {% elif field_type == 'EmailField' %} {% render_field field type="email" %} {% elif field_type == 'URLField' %} {% render_field field type="url" %} {% else %} {{ field }} {% endif %} {% endwith %}
高级用法-控制要包含哪些字段、字段的顺序以及呈现表单的列数。下面的代码将呈现一个具有给定字段、引导垂直布局、无浮点和使用3列的表单:
{% reform form 'email, number, url, time' 'vertical,false,3' %}
如承诺的那样,无bs:)
历史记录
0.1.0(2013-11-25)
- pypi上的第一个版本。
0.1.1(2013-11-25)
- 基本文件。
0.2.0(2013-12-8)
- 添加了bootstrap_工具包的as_bootstrap模板过滤器的替换项。reform template标记将原始模板上下文传递给表单模板,以便检查权限等。
0.2.1(2013-12-8)
- 添加了bootstrp cdn。
0.3.0(2013-12-10)
- 为字段包含和排序以及多列布局添加了bootstrp。