我如何指定OneToOne的反向关系可以为空,而正向关系则不能为空? (很抱歉,我将前进和后退混在一起了)
在此示例中,Something.other
可以为空,Other.something
不能为空:
class Something(Model):
name = CharField(...)
value = CharField(...)
class Other(Model):
name = CharField(...)
value = CharField(...)
something = django.db.models.OneToOneField(Something, related_name="other")