Django OneToOne reverse relationship does not allow null values
问题 I have this architecture (very simplified) from django.db import Models class MainClass(models.Model): a = models.IntegerField() b = models.CharField() class OtherClass(models.Model): c = models.IntegerField() main = models.OneToOneField(MainClass, primary_key=True) Which means my MainClass object has an attribute named otherclass, because of the existence of the reverse relationship between these models . My problem is if I specify valid values for MainClass.a and MainClass.b, but None for