在Django模型中设置blank = True时,如何区分需要null = True的字段? [英] How to distinguish field that requires null=True when blank=True is set in Django models?

查看:68
本文介绍了在Django模型中设置blank = True时,如何区分需要null = True的字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些模型字段(例如DateTimeField)在设置blank = True选项时需要null = True选项。

Some model fields such as DateTimeField require null=True option when blank=True option is set.

我想知道哪些字段需要(可能取决于

I'd like to know which fields require that (maybe dependent on backend DBMS), and there is any way to do this automatically.

推荐答案

此帖子应该有助于理解以下内容的区别在Django中空白 null

This post should help to understand the difference on blank and null in Django

这篇关于在Django模型中设置blank = True时,如何区分需要null = True的字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆