django创建用户时创建行

时间:2018-08-06 18:41:06

标签: python django

class Student(models.Model):
    user = models.OneToOneField(
        User, on_delete=models.CASCADE, primary_key=True)
    dob = models.DateField(blank=True, null=True)
    student_rank = models.OneToOneField(
        StudentRankSignoff, on_delete=models.CASCADE, null=True)

    def __str__(self):
        return self.user.username`

当学生注册时,我想让StudentRankSignoff表包含空白行。我该怎么做?

0 个答案:

没有答案