Last active
June 19, 2024 16:52
-
-
Save VincentLoy/e693aa1f149a59f465a5a71b6d937b9a to your computer and use it in GitHub Desktop.
Easy snippet to get breadcrumb in a Wagtail page
Unfortunately, I do not think that's a case for me. I strongly believe I caused a confusion since I may not have the same application method as you refer, sorry about it.
I used your Wagtail repo. It still hits DB.
This is my "simplified" Page class. I basically, applied your method to create a breadcrumb. Nothing more or less.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ismayil-ismayilov To be clear, you're not going from your browser to the page? IE the
page.route
method does not get invoked?Get ancestors will for now always perform a query - it is not cached.
The parent objects however are cached upon routing to that page.
IE.
Homepage
> BlogPage
> > BlogIndexPage
You should be able to travel from
BlogIndexPage
toHomepage
usingget_parent
without it performing any queries (inside the serve method ofBlogIndexPage
, afterpage.route
has been invoked by the page serve view)Can you tell me if this is the case for you?