Monday, March 28, 2011

Is there any way to override variable of parent (super) template in child template

Is there any way to override variable of parent (super) template in
child template? For example, I have following templates:

base.html
<title>{{ title }}</title>

{% block body %}
<h1>{{ title }}</h1>
{% block content %}{% endblock %}
{% endblock %}


child.html
{% extends 'base.html' %}

{% block content %}
{% set title %}My title{% endset %}
{% endblock %}

How to accomplish this using Django templates?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment