python orm字段解析

null                # 是否可以为空
default             # 默认值
primary_key         # 主键
db_column           # 列名
db_index            # 索引(db_index=True)
unique              # 唯一索引(unique=True)
unique_for_date     # 只对日期索引
unique_for_month    # 只对月份索引
unique_for_year     # 只对年做索引
auto_now            # 创建时,自动生成时间
auto_now_add        # 更新时,自动更新为当前时间
blank              # 是否可以为空
verbose_name       # 显示字段中文
editable           # 是否可以被编辑
error_messages     # 错误信息
    # error_messages={"required":"密码不能为空",}  # 注意必须有逗号
help_text          # 提示
validators         # ,自定义错误信息
 
python manage.py createsuperuser    # 创建 Django 用户

猜你喜欢

转载自www.cnblogs.com/konglingxi/p/9850648.html