• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
谢城
博客园    首页    新随笔    联系   管理    订阅  订阅

django基本数据类型

1.django内自带的orm的数据类型

 数字类型有:

                   mysql                   django

                      int                     IntegerField

                    smallint               SmallIntegerField

                    bigint                   BigIntegerField

                    float                      FloatFirld

                   decimal(5.2)            DeimalField

 字符串

                  varchar                  CharField

                   text                        TextField

时间 

                    datetime                DateTimeField

                     date                       DateField

参数 :

      max_length :设置类型的长度

       null =True   设置为null

       db_index=True    设置索引

       unique :       设置唯一索引

       db_colum : 设置一个列名

       unique_together:联合唯一索引

       index_tegether: 普通联合索引

 

     

 

posted @ 2019-07-17 19:26  谢城  阅读(1366)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3