Open helenb opened 1 year ago
I've reproduced this in a demo project here: https://github.com/b-ggs/django-pattern-library-issue-209
Seems that the issue happens with these specific conditions:
include
s some Template Binclude_block
from Wagtail)Templates B and C render properly, but as of django-pattern-library
0.7.0
, Template A will not render.
I've updated the title to reflect @b-ggs's findings
Found a bug? Please fill out the sections below. 👍
Issue Summary
This issue is present in both 0.7.0 and 1.0.0 versions, but not in 0.6.0
You can repeat the issue by creating a simple template called
test_block.html
that includes another template in a for loop usinginclude_block
test_block.html:
test_block.yaml:
test_block.html
will render by itself in the pattern library without any issue. However, if we have astream_block.html
template that is being used to include some example blocks for apage.body
then we see the bug.Take a page template that includes the following markup:
{% include_block page.body %}
This will repeatedly use a
stream_block
template to render the blocks inpage.body
. The yaml for thestream_block
instructs the pattern library to render another templatestory_container.html
, which is only used by the pattern library, and includes a list of example blocks to be rendered for page templates. If we add ourtest_block.html
to this like so it renders an error:story_container.html
:The error is as follows:
If I change the
include_block
tag intest_block.html
to a simpleinclude
tag and pass it the template name, then the issue no longer occurs. If I change the pattern library version for my project to0.6.0
the issue no longer occurs.Steps to Reproduce
Create a build using pattern library version 0.7.0 or higher Create a test template as described above, with a forloop and an
include_block
Try adding the test template to astory_container
type template, being used to render a set of example blocks forpage.body
in the pattern library.Technical details