Django 基础笔记 02

1. 为什么使用 class based views ,and generic views??

  1. 更容易拓展,面向对象的,更容易使用继承,更方便重复使用
  2. 可以根据请求方法来分类 GET, POST等等
  3. 而且 generic views,更加 extensible and flexible
  4. 感觉下面这句又像是一句名言:
    “These options seem to add hollow complexity for simple situations, but without them, more advanced designs would be limited”

2. 又是文档中的几句名言

1. You only need to write the parts that make your project unique.
2. Web development is often broad, not deep – problems span many domains. 
3. Generic views really shine when working with models.

3. base.html 使用 bootstrap:


{% block content %} {% endblock %}

4. 简单使用 crispy_forms

CRISPY_TEMPLATE_PACK = 'bootstrap4'  # settings.py
{% load crispy_forms_tags %}    # add at top
{{ form }}     # old
{{ form |crispy }} # new

你可能感兴趣的:(Django 基础笔记 02)