Skip to content

djangodocs

Django 2.2
  • 6.1 current
  • 6.0
  • 5.2 LTS
  • 5.1 unsupported
  • 5.0 unsupported
  • 4.2 unsupported
  • 4.1 unsupported
  • 4.0 unsupported
  • 3.2 unsupported
  • 3.1 unsupported
  • 3.0 unsupported
  • 2.2 unsupported
  • 2.1 unsupported
  • 2.0 unsupported
简体中文
  • English
  • 简体中文
  • Français
  • 日本語
  • Bahasa Indonesia
  • Português (Brasil)
  • 한국어
  • Español
  • Ελληνικά
  • Polski
Documentation contents
  • Django 文档
  • 开始
  • 使用 Django
    • 如何安装 Django
    • 模型和数据库
      • 模型
      • 执行查询
      • 聚合
      • 搜索
      • 管理器
      • 执行原生 SQL 查询
      • 数据库事务
      • 多数据库
      • 表空间(Tablespaces)
      • 数据库连接优化
      • 数据库工具
      • 模型关联 API 用法示例
    • 处理 HTTP 请求
    • 使用表单
    • 模板
    • 基于类的视图
    • 迁移
    • 管理文件
    • Django 中的测试
    • Django中的用户认证
    • Django 缓存框架
    • 条件视图处理
    • Cryptographic signing
    • 发送邮件
    • 国际化和本地化
    • 日志
    • 分页
    • Security in Django
    • 性能和优化
    • Serializing Django objects
    • Django 配置
    • 信号
    • 系统检查框架
    • 扩展包
  • 操作指南
  • Django FAQ
  • API参考
  • 元文件和杂记
  • 术语
  • Release notes
  • Django internals
Django 2.2 is no longer supported. It receives no security fixes. Use it for reference only. Latest release
Chinese (Simplified) translation. Untranslated passages appear in English. 33.5% Help translate
  1. Django 2.2
  2. 使用 Django

模型和数据库Link to this heading#

模型准确且唯一的描述了数据。它包含您储存的数据的重要字段和行为。一般来说,每一个模型都映射一张数据库表。

  • 模型
  • 执行查询
  • 聚合
  • 搜索
  • 管理器
  • 执行原生 SQL 查询
  • 数据库事务
  • 多数据库
  • 表空间(Tablespaces)
  • 数据库连接优化
  • 数据库工具
  • 模型关联 API 用法示例
View as Markdown Edit this page on GitHub Official version
Previous如何安装 Django Next模型

An unofficial rendering of the Django documentation.

Not affiliated with or endorsed by the Django Software Foundation. The documentation is copyright © Django Software Foundation and individual contributors, and is used under the BSD 3-Clause licence. “Django” is a trademark of the Django Software Foundation.

This translation is the work of the Django i18n community, not of this site. Read the official documentation at docs.djangoproject.com.

👋 Jason Cartwright