Code

Opened 5 years ago

Closed 5 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: UI/UX:

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.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by 0ptr

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

{% extends ua_based_template %}

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.