开发者

Django parent_id - should it be NULL, blank, or 0?

开发者 https://www.devze.com 2023-03-23 21:46 出处:网络
When I have top-level tree items, should i consider using blank=True, null=True or开发者_JS百科 default=0 ?

When I have top-level tree items, should i consider using blank=True, null=True or开发者_JS百科 default=0 ?

What complications can arise in which of those cases, and therefore which should I use?

thanx


If you have blank=True or default=0 then you will be expected to have parents that match that when you move to a database that actually supports referential integrity. Always use NULL/None, unless you have a good reason for using something else.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号