我有两个模型,Address
和Subscription
。我希望Subscription
模型与Address
具有ForeignKey或OneToOne关系
class Address(models.Model):
street_address = models.CharField(
max_length=255,
blank=True,
default="",
)
...
class Subscription(models.Model):
subscriber_address = models.OneToOneField(
Address,
on_delete=models.SET_NULL,
null=True,
related_name='related_entity'
)
panels = [
InlinePanel("subscriber_address"),
]
我还希望用户能够编辑地址字段时,通过wagtailui编辑订阅实例
但是,尝试使用上述配置创建订阅时,出现以下错误:
'ForwardOneToOneDescriptor' object has no attribute 'rel'
通过Wagtail InlinePanel呈现ForeignKey或OneToOne关系的正确方法是什么
目前没有回答
相关问题 更多 >
编程相关推荐