开发者

Django parent_id - should it be NULL, blank, or 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜