In the admin area I have to activate the "Enable ordering of child pages" every time. Is there a way to set this as a permanent option? The main problem is that the listing in the child pages view changes depending on if this is activated or not(if you have changed the ordering), which might be a bit confusing for some.
Potentially one could change the default ordering of the children list to match the manually ordered list somehow?
Ok, as of now. It doesn't seem that this is possible. But it does seem that it respects django models default ordering. https://docs.djangoproject.com/en/2.1/ref/models/options/#ordering
Setting the Meta.ordering
on the ChildPage model didn't work for me, but overriding the Parent Page's get_children()
method by returning the ordered QuerySet resolved the child page order issue.
class MyRootPage(Page):
description = models.CharField(max_length=255, blank=True)
content_panels = Page.content_panels + [FieldPanel("description", classname="full")]
def get_children(self):
qs = super().get_children()
qs = qs.order_by('-last_published_at')
return qs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With