#1 by Franca
I have a project with multiple apps. In all apps, I want to have a button that, when clicked, displays the instructions again. Since I try to not repeat code, I added the code for the button to the global template in the content block, and the instructions in the _templates/global folder as well. In my child template (app/template.html), when I don't define a content block, the template correctly reads what is in that block in the parent template, renders the clickable button and displays the (placeholder) instructions. However, when I add a content block in my child template and I want to avoid overwriting the parent template ({% block content%} {{ block.super }} {% endblock} ), I get the error that the variable 'block' cannot be resolved. I wasn't sure if the simplified syntax ({{ instead of {%) was responsible for the error, and have changed all templates extending global/Page.html to the traditional syntax. In settings, I have also inserted OTREE_TEMPLATE_MODE = 'django'. Can I not use {{ block.super }} in my child template in otree? Here are my files: **global/Page.html:** {% extends 'otree/Page.html' %} {% load otree static %} {% block content %} <p>This is from global/Page.html.</p> <p> <!-- Button trigger modal --> <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal"> Show instructions again </button> </p> {% include 'global/instructions_modal.html' %} {% endblock %} **global/instructions_modal.html:** <!-- Modal --> <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Instructions</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <p> test test Instructions from instructions.modal.html test test </p> </div> <div class="modal-footer"> <button type="button" class="btn btn-outline-primary" data-bs-dismiss="modal">Close</button> </div> </div> </div> </div> ** app/template.html:** {% extends 'global/Page.html' %} {% block title %} Instructions {% endblock %} {% block content %} {{ block.super }} {{ Lexicon.instructions | safe }} {% endblock %} Error: raise errors.UndefinedVariable(msg, token) from None otree.templating.errors.UndefinedVariable: Cannot resolve the variable 'block' (line 8, in "block.super")