zoukankan      html  css  js  c++  java
  • #module-django.db.models

    Models

    A model is the single, definitive source of information about your data. It contains the essential fields and behaviors of the data you're storing. Generally, each model maps to a single database table.

    The basics:

    • Each model is a Python class that subclasses django.db.models.Model.
    • Each attribute of the model represents a database field.
    • With all of this, Django gives you an automatically-generated database-access API; see Making queries.

      Quick example

      Using models

      Fields

      Field types

      Field options

      null

      blank

      choices

      default

      help_text

      primary_key

      unique

      Automatic primary key fields

      Verbose field names

      Relationships

      Many-to-one relationships

      Many-to-many relationships

      Extra fields on many-to-many relationships

      One-to-one relationships

      Models across files

      Field name restrictions

      Custom field types

      Meta options

      Model methods

      Overriding predefined model methods

      Overriding predefined model methods

      Executing custom SQL

      Model inheritance

      Abstract base classes

      Meta inheritance

      Be careful with related_name

      Multi-table inheritance

      Meta and multi-table inheritance

      Proxy models

      Base class restrictions

      Multiple inheritance

      Field name "hiding" is not permitted

  • 相关阅读:
    了解jQuery
    jQuery其他关系查找方法
    jQuery中的入口函数
    漫谈《挪威的森林》
    再说变
    再说鞋
    SDG
    Apache Geode简介
    2021/11/24策略模式
    2021/11/26
  • 原文地址:https://www.cnblogs.com/MrWho/p/3886059.html
Copyright © 2011-2022 走看看