第十章 附加功能.md
最后更新于:2022-04-01 22:00:01
第九章 数据的导入与导出.md
最后更新于:2022-04-01 21:59:59
第八章 层次化结构.md
最后更新于:2022-04-01 21:59:57
第七章 Django CMS.md
最后更新于:2022-04-01 21:59:54
第六章 模型管理.md
最后更新于:2022-04-01 21:59:52
第五章 定制模板过滤器与标签.md
最后更新于:2022-04-01 21:59:50
第四章 模板与JavaScript.md
最后更新于:2022-04-01 21:59:47
{% trans "My Website" %}
{% block header_navigation %} {% include "utils/header_navigation.html" %} {% endblock %} {% block language_chooser %} {% include "utils/language_chooser.html" %} {% endblock %}第三章 表单与视图.md
最后更新于:2022-04-01 21:59:45
{% trans "Available formats are JPG, GIF, and PNG. Minimal “size is 800 × 800 px." %}
"""), title=_("Image upload"), css_id="image_fieldset", ), layout.Fieldset( _("Contact"), layout.Field("contact_person", css_class="input-blocklevel"), layout.Div( bootstrap.PrependedText("phone", """""", css_class="inputblock-level"), bootstrap.PrependedText("email", "@", css_class="input-block-level", placeholder="contact@example.com"), css_id="contact_info", ), ), bootstrap.FormActions( layout.Submit('submit', _('Save')), ) ) ``` 要渲染模板中的表单,如下,我们只需载入标签冷酷`crispy_forms_tags`,然后使用模板标签`{% crispy %}`: ```python #templates/bulletin_board/change_form.html} {% extends "base.html" %} {% load crispy_forms_tags %} {% block content %} {% crispy form %} {% endblock %} ``` ## 工作原理 拥有新闻简报表的页面的样子大概如此: 图片:略 As you see, the fields are grouped by fieldsets. The first argument of the Fieldset object defines the legend, the other positional arguments define fields. You can also pass named arguments to define HTML attributes for the fieldset; for example, for the second fieldset, we are passing title and css_id to set the HTML attributes title and id. 如你所见,字段是由字段集合组成的。 Fields can also have additional attributes passed by named arguments, for example, for the description field, we are passing css_class and rows to set the HTML attributes class and rows. 字段也可以通过传递命名参数拥有额外的属性,例如, Besides the normal fields, you can pass HTML snippets as this is done with the help block for the image field. You can also have prepended-text fields in the layout, for example, we added a phone icon to the phone field, and an @ sign for the email field. As you see from the example with contact fields, we can easily wrap fields into HTML{% trans "Filter by Genre" %}
{% trans "Filter by Director" %}
{% trans "Filter by Actor" %}
{% trans "Filter by Rating" %}
{{ movie.title }}
{{ movie.title }}
-
{% if object_list.has_previous %}
- « {% else %}
- « {% endif %} {% for page_number in object_list.paginator.page_range %} {% if page_number == object_list.number %}
- {{ page_number }} (current) {% else %}
- {{ page_number }} {% endif %} {% endfor %} {% if object_list.has_next %}
- » {% else %}
- » {% endif %}
Curriculum Vitae
{{ cv.first_name }} {{ cv.last_name }} |
Experience
{{ experience.from_date|date:"F Y" }} -
{% if experience.till_date %}
{{ experience.till_date|date:"F Y" }}
{% else %}
present
{% endif %} |
Skills gained |
, , and other headings are broken and there is no concept of floating, so instead you have to use paragraphs with CSS classes for different font styles and tables for multi-column layouts. However, this library is still mighty enough for customized layouts, which basically can be created just with the knowledge of HTML and CSS.
## 参阅
The Managing paginated lists recipe
**********
本章完
{% endraw %}
第二章 数据库结构.md
最后更新于:2022-04-01 21:59:43
第一章 Django1.6入门.md
最后更新于:2022-04-01 21:59:40
目录.md
最后更新于:2022-04-01 21:59:38
介绍
最后更新于:2022-04-01 21:59:36