Py学习  »  Django

如何在外键django管理中使用详细名称?

Mary • 5 年前 • 1474 次点击  

class ParentsProfile(models.Model):
    Fathers_Firstname = models.CharField(verbose_name="Firstname", max_length=500,null=True,blank=True)
    Fathers_Middle_Initial = models.CharField(verbose_name="Middle Initial", max_length=500,null=True,blank=True, help_text="Father")
    Fathers_Lastname = models.CharField(verbose_name="Lastname", max_length=500,null=True,blank=True)
    Educational_AttainmentID_Father = models.ForeignKey(EducationalAttainment,on_delete=models.CASCADE,null=True,blank=True)

我已经试着用 教育成就id父=models.ForeignKey(“教育成就”,教育成就,on_delete=models.CASCADE,null=True,blank=True) 但没用

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/56222
 
1474 次点击  
文章 [ 1 ]  |  最新文章 5 年前
Justin
Reply   •   1 楼
Justin    5 年前

试试这个,

Educational_AttainmentID_Father = models.ForeignKey(EducationalAttainment, on_delete=models.CASCADE,null=True,blank=True, verbose_name="EducationalAttainment")