博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Django model :add a non-nullable field 'SKU' to product without a default; we can't do that
阅读量:7077 次
发布时间:2019-06-28

本文共 642 字,大约阅读时间需要 2 分钟。

You are trying to add a non-nullable field 'SKU' to product without a default; we can't do that (the database needs something to populate existing rows).

Please select a fix:

 1) Provide a one-off default now (will be set on all existing rows)

 2) Quit, and let me add a default in models.py

Select an option: 1

Please enter the default value now, as valid Python

The datetime and django.utils.timezone modules are available, so you can do e.g.

timezone.now()

>>> timezone.now()

 

如何还是不断重复上述提示,那么就该model的字段删除,重新再写一次,

然后

python3 manage.py makemigrations

python3 manage.py migrate

..........

 

转载于:https://www.cnblogs.com/alan-babyblog/p/5738975.html

你可能感兴趣的文章
kafka术语
查看>>
mitmproxy
查看>>
kafa单机版环境搭建
查看>>
kettle报错收集
查看>>
Json
查看>>
分布式隐式事务
查看>>
python中的str.strip()的用法
查看>>
递归函数
查看>>
Shell 输入/输出重定向
查看>>
go package包的使用
查看>>
MongoDB学习笔记Day3
查看>>
spark学习1(hadoop集群搭建)
查看>>
ABP源码分析三十二:ABP.SignalR
查看>>
复选框提交功能
查看>>
windows 7 64位 安装oracle 11g R2
查看>>
Spring @Resource, @Autowired and @Inject 注入
查看>>
微服务学习笔记二:Eureka服务注册发现
查看>>
获取免费代理推荐
查看>>
bootstrap 不兼容ie8 的问题
查看>>
silverlight 动态类创建和使用
查看>>