-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Must {% load sameastags %} in root template! #4
Comments
Thanks for pointing this! I'll examine the problem later this month. |
Thanks! I did notice this bit in the Custom template tags docs:
I spent some time in the source debugging this and some related issues, but I really haven't fully grokked the implications, or why "sameas" is currently working across blocks in certain circumstances. |
I think I've got a better understanding of this now:
So given all that, to share nested blocks between parent blocks you have to do something like this: base template (or parent block) container
inheriting template
The container has to both load the sameas library and to render the reused block to set the cached contents "low enough" down in the rendering context stack. If container_one tried to render the block itself, it would be stored but only until that block "closed", then it would be missing for container_two. You might be able to fix this by "manually" storing the rendered contents farther down in the block stack — but be careful since the lowest level might be shared between threads/page renders (I could be mistaken?). |
t_base_base.html:
t_base.html:
t_page.html
If you leave the sameastags commented out in t_base_base.html, even though it doesn't directly use the
sameas
tag, you get:There seems to be a bit more at play here with context pushing/popping, but I suspect the main trouble stems from the lack of this plugin's BlockNode override when rendering the parent templates.
The text was updated successfully, but these errors were encountered: