django-bootstrap-studio-tools
django-bootstrap-studio-tools copied to clipboard
dj-ref with multiple childrens
Problem is show in your example.html file:
<div dj-block="title" >
<div dj-ref="section.title">
<h1>{{ section.title }} </h1>
</div>
</div>
is converted to :
{% block title %}
<div>
<div>
<h1>
{{ section.title }}
</h1>
</div>
</div>
{% endblock %}
Actually, dj-ref is not used to create the {{selection.title}}, and use the string already avaible in the example (why using django tag in the example ?).
Actually, bs4 tag is setting string attribute to None when having multiple childs : https://www.crummy.com/software/BeautifulSoup/bs4/doc/#string
You're skipping change with condition:
if ref.string:
ref.string.replace_with('{{ ' + refattr + ' }}')