Stodge schrieb:
> Can I wrap the "extends" tag in an "if" tag? I tried it but I get:

[...]

> Is there another way of doing this? I want my view to control whether
> the header is displayed or not.

{% extends %} also takes a variable (instead of a static string), so you
could define two parent views ("with_header.html" and
"without_header.html") and put the following into your template:

{% extends base_template %}

Then in your view code instead of setting show_header you would set
base_template to either one of your base templates:

def view(request):
    ...
    if show_header:
        base_template = 'with_header.html'
    else:
        base_template = 'without_header.html'
    ...


hth,
 chris

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


Reply via email to