{"title":"模型和数据库","version":"2.1","locale":"zh-hans","docname":"topics/db/index","url":"/zh-hans/2.1/topics/db/","canonical":"https://djangodocs.dev/zh-hans/2.1/topics/db/","summary":"模型是您的数据唯一而且准确的信息来源。它包含您正在储存的数据的重要字段和行为。一般来说，每一个模型都映射一个数据库表。","html":"<span id=\"models-and-databases\"></span><h1>模型和数据库<a class=\"heading-anchor\" href=\"#module-django.db\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>模型是您的数据唯一而且准确的信息来源。它包含您正在储存的数据的重要字段和行为。一般来说，每一个模型都映射一个数据库表。</p>\n<div class=\"toctree-wrapper compound\">\n<ul>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/models/\">模型</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/queries/\">进行查询</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/aggregation/\">聚合</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/search/\">搜索</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/managers/\">Managers</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/sql/\">Performing raw SQL queries</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/transactions/\">数据库事务</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/multi-db/\">Multiple databases</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/tablespaces/\">Tablespaces</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/optimization/\">Database access optimization</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/instrumentation/\">Database instrumentation</a></li>\n<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"/zh-hans/2.1/topics/db/examples/\">Examples of model relationship API usage</a></li>\n</ul>\n</div>","rootId":"module-django.db","toc":[],"breadcrumbs":[{"docname":"topics/index","title":"Using Django","url":"/zh-hans/2.1/topics/"}],"prev":{"docname":"topics/install","title":"如何安装Django","url":"/zh-hans/2.1/topics/install/"},"next":{"docname":"topics/db/models","title":"模型","url":"/zh-hans/2.1/topics/db/models/"},"formats":{"html":"/zh-hans/2.1/topics/db/","markdown":"/zh-hans/2.1/topics/db.md","json":"/zh-hans/2.1/topics/db.json"},"source":"https://github.com/django/django/blob/stable/2.1.x/docs/topics/db/index.txt","official":"https://docs.djangoproject.com/zh-hans/2.1/topics/db/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0"],"inLocales":["en","zh-hans","fr","ja","id","pt-br","ko","es","el","pl"]}