Hello,
I would like to adjust the default result order for a custom page type's QuerySet. To do that, I'm trying to extend the PageManager's get_query_set() function:
from wagtail.wagtailcore.models import PageManager
class StaffPageManager(PageManager):
def get_query_set(self):
return (
super(StaffPageManager, self)
.get_query_set()
.order_by('title')
)
#Then, in my custom page:
class StaffPage(Page):
...
objects = StaffPageManager
...
However, when I do this, I get the following error message:
ERRORS:
staff.StaffPage: (wagtailcore.E002) Manager does not inherit from PageManager
HINT: Ensure that custom Page managers inherit from django.db.models.manager.BasePageManagerFromPageQuerySet
However, I'm not able to inherit from BasePageManagerFromPageQuerySet, because that class doesn't exist.
Can anyone tell what I'm doing wrong here? Any help to get me back on track would be greatly appreciated.
Thanks so much!
Best,
John