[Django] #28468: Template braces within {% with %} are not evaluated

8 views
Skip to first unread message

Django

unread,
Aug 6, 2017, 7:57:32 AM8/6/17
to django-...@googlegroups.com
#28468: Template braces within {% with %} are not evaluated
-------------------------------------------+------------------------
Reporter: Liquid Scorpio | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
I am not sure if this is a bug or limitation, I will add here anyways.

Consider following code inside a django template:


{{{
{% include 'partials/_message.html' with
message_title="Unauthorised"
message_body="You need <strong>{{ perm_name }}</strong>
permission to access the content." %}
}}}

The issue is related to the output rendered in browser for *message_body*
when {% include %} is executed.

==== Expected output:
You need **read** permission to access the content.

==== Actual output:
You need **{{ perm_name }}** permission to access the content.

==== Notes
While the included template evaluates the passed in **<strong>** tag, it
does not evaluate the variable **{{ perm_name }}** and outputs it
verbatim.

--
Ticket URL: <https://code.djangoproject.com/ticket/28468>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 7, 2017, 7:53:41 AM8/7/17
to django-...@googlegroups.com
#28468: Template braces within {% with %} are not evaluated
---------------------------------+--------------------------------------

Reporter: Liquid Scorpio | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Aymeric Augustin):

I think the current behavior is the expected behavior.

`"You need <strong>{{ perm_name }}</strong> permission to access the
content."` is a string literal.

--
Ticket URL: <https://code.djangoproject.com/ticket/28468#comment:1>

Django

unread,
Aug 7, 2017, 11:24:38 AM8/7/17
to django-...@googlegroups.com
#28468: Template braces within {% include ... with="..." %} are not evaluated
---------------------------------+--------------------------------------

Reporter: Liquid Scorpio | Owner: nobody
Type: Uncategorized | Status: closed

Component: Template system | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/28468#comment:2>

Django

unread,
Aug 12, 2017, 4:18:14 AM8/12/17
to django-...@googlegroups.com
#28468: Template braces within {% include ... with="..." %} are not evaluated
---------------------------------+--------------------------------------
Reporter: Liquid Scorpio | Owner: nobody
Type: Uncategorized | Status: closed

Component: Template system | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Liquid Scorpio):

Fair Enough. However, any suggested approach to get the desired output?

--
Ticket URL: <https://code.djangoproject.com/ticket/28468#comment:3>

Reply all
Reply to author
Forward
0 new messages