[Answer]-How can I override an inherited container in Django templates?

1👍

If you can change a bit your base.html template

{% block content_wrapper %}
  <div class="container">
    {% block content %}
    {% endblock content %}
  </div>
{% endblock content_wrapper %}

Then in your few specifics template you can override the content_wrapper block.

0👍

The easiest way as I see it is to create another base template that you extend. Perhaps calling it base-purpose.html. Another way could be to use the {% include 'another.html' %} tag. This might be able to solve your problem as well.

See the discussion between include and extend on stackoverflow

Leave a comment