python - How to include block of code to every page except base.html -
I need to create a small side block with the form (it has only one field and button) and I I wanted to make simple view functions on every page except base.html
, but maybe there are better ways to do this?
I'm using Python and Django 1.6
Normally, you Base.html should not be used directly, but because you and it will be a big problem to change it in every other template, whatever you can do, it is in the visual function, which gives the base 2.0, Boolean can add and check the boolean which template you are
something like this:
def view_that_uses_b Ase.html (request): is_base = true return render_to_response ("base.html", {"is_base": is_base}, RequestContext (request, {})
and then in the template :
{% block sidebar%} {% if is_base%} {% else%} # Your code here {% endif%} {% endblock sidebar%}
Comments
Post a Comment