Python 对象分配错误,有人能告诉我我做错了什么吗?因为,这是2天前和平迁移的
有人能告诉我我到底做错了什么,因为它总是弹出AttributeError:type对象“HomePage”没有属性“landing” relatedlink对象已正确配置,以便主页登录和主页支持从其继承并利用其实例和属性Python 对象分配错误,有人能告诉我我做错了什么吗?因为,这是2天前和平迁移的,python,Python,有人能告诉我我到底做错了什么,因为它总是弹出AttributeError:type对象“HomePage”没有属性“landing” relatedlink对象已正确配置,以便主页登录和主页支持从其继承并利用其实例和属性 # Home Page class HomePageLanding(Orderable, RelatedLink): page = ParentalKey('ibro.HomePage', related_name='landing') colour = mod
# Home Page
class HomePageLanding(Orderable, RelatedLink):
page = ParentalKey('ibro.HomePage', related_name='landing')
colour = models.CharField(max_length=255)
background = models.ForeignKey(
'ibro.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
logo = models.ForeignKey(
'ibro.IbroImage',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
text = models.CharField(
max_length=255
)
panels = RelatedLink.panels + [
ImageChooserPanel('background'),
ImageChooserPanel('logo'),
FieldPanel('colour'),
FieldPanel('text'),
]
class HomePageSupports(Orderable, RelatedLink):
page = ParentalKey('ibro.HomePage', related_name='supports')
image = models.ForeignKey(
'ibro.IbroImage',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
panels = RelatedLink.panels + [
ImageChooserPanel('image')
]
class HomePage(Page):
hero_intro_primary = models.TextField(blank=True)
hero_intro_secondary = models.TextField(blank=True)
intro_body = RichTextField(blank=True)
socialmedia_title = models.TextField(blank=True)
blog_title = models.TextField(blank=True)
supports_title = models.TextField(blank=True)
class Meta:
verbose_name = "Homepage"
content_panels = [
FieldPanel('title', classname="full title"),
MultiFieldPanel(
[
FieldPanel('landing_intro_primary'),
FieldPanel('landing_intro_secondary'),
],
heading="Landing intro"
),
InlinePanel('landing', label="Landing"),
FieldPanel('intro_body'),
FieldPanel('Socialmedia_title'),
FieldPanel('blog_title'),
FieldPanel('supports_title'),
InlinePanel('supports', label="Supports"),
]
你能提供正在发生的实际错误吗?AttributeError:type对象“HomePage”没有属性“landing”这就是错误,user2896976,你知道为什么会这样吗?我得到的错误的其他信息,这似乎不是来自于bind\u to\u model related=getattr(model,self.relationship\u name)第686行的edit\u handers文件“/home/ibrokola/Desktop/NewIbro/my\u env/lib/python3.5/site packages/wagtail/wagtailadmin/edit\u handlers.py”.rel请使用问题下方的链接添加其他信息,而不是在可以忽略的注释中。您可以提供正在发生的实际错误吗?AttributeError:type对象“HomePage”没有属性“landing”,这是错误,user2896976,你知道为什么会这样吗?我得到的错误的其他信息,似乎不是来自编辑\u handers文件“/home/ibrokola/Desktop/NewIbro/my_env/lib/python3.5/site packages/wagtail/wagtailadmin/edit\u handlers.py”,第686行,在bind_to_model related=getattr(model,self.relation_name)中。请使用问题下方的链接添加其他信息,而不是在注释中添加可以忽略的信息