Re: Can a template extend a template?
On Tue, Dec 13, 2011 at 7:21 PM, Jason <1jason.whatford@gmail.com> wrote:
> Hi there,
>
> I love the concept of DRY, and django's enthusiasm for this concept. In
> light of this I have tried to have a template extend a template, but it
> doesn't seem to work. Is there a better way than what I'm currently doing?
>
> The current way
>
> index.html
>
> {% if current_user %}
> {% extends "_logged_out_template.html" %}
>
> {% else %}
> {% extends "_logged_in_template.html" %}
> {% endif %}
>
> contact.html
>
> {% if current_user %}
>
> {% extends "_logged_out_template.html" %}
>
> {% else %}
>
> {% extends "_logged_in_template.html" %}
>
> {% endif %}
>
>
>
> The way I would like it to be (but it didn't work)
>
> index.html
> {% extends "_base_template.html" %}
>
> _base_script.html
>
> {% if current_user %}
>
> {% extends "_logged_out_template.html" %}
>
> {% else %}
>
> {% extends "_logged_in_template.html" %}
>
> {% endif %}
>
I don't see why it doesn't work. Post the errors you are having.
I use templates that extends templates with no issues.
--
Kind Regards
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home