On Tue, Mar 5, 2013 at 9:06 PM, Sandeep kaur <mkaurkha...@gmail.com> wrote:
> I want to extend the base template file into the child file depending
> on the condition, like if the user is superuser or staff or active
> user, the file to extended should ll be different.
> For Eg :
>
> {% if user.is_superuser %}
>         {% extends "base.html" %}
> {% else if user.is_active %}
>         {% extends "base_client.html" %}
> {% else %}
>         {% extends "base_noclient.html" %}
>
>
> However this code doesn't work.
> What should be done. Your help will be highly appreciated.
> Thank you.
>

{% extends %} can either take a string literal, or a variable. Move
the logic to decide which base template to use into your view, pass
the variable to the template in the context, and use that as the
argument to {% extends %}.

Cheers

Tom

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


Reply via email to