如果模型在w中是内联的,如何在search_fields中包括一个字段

时间:2019-01-16 10:47:54

标签: django inheritance wagtail

我试图在类BaseClass的搜索中包含一个字段,我想在Subclass类中搜索一个字段,该类继承自具有BaseClass的Orderable和ParentalKey类,如何在search_field中添加子类的字段

class BaseClass(Page):
    header = models.CharField(max_length=255, blank=True)
    search_fields = Page.search_fields + [
        index.SearchField('title', partial_match=True)]

class SubClass(Orderable):
    article = ParentalKey('BaseClass',on_delete=models.CASCADE,
    related_name='article_description')
    body = RichTextUploadingField(_('Body'), blank=True)

0 个答案:

没有答案