Opened 15 years ago

Closed 15 years ago

#10003 closed (invalid)

if and extends in template

Reported by: 0ptr Owned by: nobody
Component: Template system Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

{% if mobile %}
{% extends 'base_mobile.html' %}
{% else %}
{% extends 'base_normal.html' %}
{% endif %}


Throws following exception:

Exception Type:	TemplateSyntaxError
Exception Value:	
Invalid block tag: 'else'
Exception Location:	/home/dsduser/django-synble/django/template/__init__.py in invalid_block_tag, line 333

I think this should be supported. Second option is to write include correctly so that include does not broke inheritance. E.g.:

basbase.html: has block

base.html: include "basebase.html"

logic.html: extends "base.html", inheritance of basbase.html block does not work here anymore.

Change History (1)

comment:1 by 0ptr, 15 years ago

Resolution: invalid
Status: newclosed

Ok actually better way is to return the template name from context processor and extend it directly

{% extends ua_based_template %}

Note: See TracTickets for help on using tickets.
Back to Top