【发布时间】:2010-04-16 03:22:58
【问题描述】:
这似乎很基本,我一定遗漏了一些东西,但无论如何……
有两个这样的模型:
class School(models.Model):
name = models.CharField("Official School Name", max_length=128)
address = models.TextField("Address of the School", max_length=256)
mascot = models.CharField("Name of the School Mascot", max_length=128)
class StudentProfile(models.Model):
name = models.CharField(max_length=128)
school = models.ForeignKey(School)
如果学生是在学校之前创建的,我如何给“学校”一个默认的空值?是 blank 还是 null 还是 what?
谢谢!
【问题讨论】:
标签: django foreign-keys