I’m trying to use nested inline Panels (with wagtail version 6.1)
Everything seems to work fine except when I’m trying to see the usage of the snippet used in the nested inline panel in the admin interface. It shows me that the snippet is used 1 time which is right, but when I’m trying to click on ‘Used 1 time” link to see more detail i get this error :
ManyToOneRel' object has no attribute 'verbose_name'
Which occurs on this part of the wagtail code : wagtail/models/reference_index.py, line 653, in describe_source_field
return capfirst(child_field.verbose_name)
Here is a simplify version of my page, models and snippet used :
class MyPage(Page):
# Editor panels configuration
promote_panels = Page.promote_panels
content_panels = Page.content_panels + [
InlinePanel('category', heading='Categories', label='Category')
]
class Category(Orderable, ClusterableModel):
class Meta:
verbose_name = "Category"
page = ParentalKey(MyPage, related_name='category', verbose_name="Category")
cat_snippet = models.ForeignKey(CategorySnippet, on_delete=models.CASCADE, null=True)
panels = [
FieldPanel('cat_snippet', heading="Category snippet"),
InlinePanel('subcategory', heading='Subcategory', label='art')
]
class SubCategory(models.Model):
class Meta:
verbose_name = "SubCategory"
page = ParentalKey(Category, related_name='subcategory', verbose_name="Subcategory", on_delete=models.CASCADE,)
sub_snippet = models.ForeignKey(SubCategorySnippet, on_delete=models.CASCADE, null=True, verbose_name='sub snippet')
panels = [
FieldPanel('sub_snippet', heading='Subcategory snippet'),
]
@register_snippet
class CategorySnippet(index.Indexed, ClusterableModel):
class Meta:
verbose_name = "Category Snippet"
name = models.CharField(max_length=1024,default='')
def __str__(self):
return (f"{self.name}")
panels = [
FieldPanel('name', heading='Nom'),
]
@register_snippet
class SubCategorySnippet(index.Indexed, ClusterableModel):
class Meta:
verbose_name = "Subcategory Snippet"
name = models.CharField(max_length=1024,default='')
def __str__(self):
return (f"{self.name}")
panels = [
FieldPanel('name', heading='Nom'),
]
I can’t find anything that i could have done wrong which could cause the error.
Thanks a lot for any help