S
S
Sergey Protasov2019-06-29 23:13:59
Django
Sergey Protasov, 2019-06-29 23:13:59

Wrapper around block in Django template?

Good evening.
In the parent template, you need to insert a wrapper around the block defined in the child template, but if this block is not defined, then you do not need to insert a wrapper ( ). How can this be implemented? base.html:<div class="card stacked">...</div>

{% block content %}
    ...
    <div class="card stacked">
        <div class="card-body">
            {% block account_form %}{% endblock %}
         </div>
    </div>
    ...
{% endblock %}

login.html:
{% extends "account/base.html" %}

{% block account_form %}
    <form ...>
{% endblock %}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question