Opened 16 years ago
Closed 16 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.
Note:
See TracTickets
for help on using tickets.
Ok actually better way is to return the template name from context processor and extend it directly
{% extends ua_based_template %}