In Wagtail, consider the following page types:
class WorkshopPage(Page):
category = models.ForeignKey(
WorkshopCategory, on_delete=models.SET_NULL, blank=True, null=True
)
class WorkshopIndexPage(RoutablePageMixin, Page):
subpage_types = ["WorkshopPage"]
In the wagtail admin, I need to order the subpages of WorkshopIndexPage by their category__name
.
Since in the docs it says that setting ordering in a WorkshopPage Meta class will not work (it does not), I have tried the solution proposed here. However, when I do this inside my WorkshopIndexPage:
def get_children(self):
qs = WorkshopPage.objects.order_by("category__name")
return qs
I get an error: Cannot combine queries on two different base models.
This seems like a simple use case but I can’t seem to get it to work.