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.
精彩评论