我在model.py中创建fllowing多继承,同时运行python manage.py makemigrations获取错误 错误: - 错误: polls.VideoWithThumbnail :( models.E005)字段' media_ptr'来自父母模特' polls.video'与该领域的冲突' media_ptr'来自父母模特' polls.photo'。
job_descr house_num address
To construct 6 Unit Dwellings of Row Housings (Units 1-6; Building 10) 1 1, 14751 - 125 STREET NW
To construct 7 Dwellings of Row Housings (Units 7-13 - Building 16) 7 7, 14751 - 125 STREET NW
To construct 6 Dwellings of Row Housings (Units 14-19 - Building 4). 19 19, 14751 - 125 STREET NW
To construct 8 Dwellings of Row Housings (UNITS 20-27 - Building 3). 27 27, 14751 - 125 STREET NW
To construct 7 Dwellings of Row Housings (Units 58-64 - Building 8). 58 58, 14751 - 125 STREET NW
To construct 4 Dwellings of Row Housings (Units 65-68 - Building 9) 65 65, 14751 - 125 STREET NW
To construct 7 Dwellings of Row Housings (Units 69-75 - Buiding 15). 69 69, 14751 - 125 STREET NW
To construct 8 Dwellings of Row Housings (Units 76-83 - Building 14) 76 76, 14751 - 125 STREET NW
答案 0 :(得分:0)
您可以尝试以下代码
class Media(models.Model):
title=models.CharField(max_length=255)
pub_date=models.DateTimeField()
class Photo(Media):
photo_to_media = models.OneToOneField(Media, parent_link=True)
is_faculty = models.BooleanField(default=False)
class Video(Media):
video_to_media = models.OneToOneField(Media, parent_link=True)
is_student = models.BooleanField(default=False)
class VideoWithThumbnail(Video,Photo):
pass