[Django] #27336: Whitespace control django configuration Jinja2

12 views
Skip to first unread message

Django

unread,
Oct 12, 2016, 8:06:04 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
--------------------------------------+--------------------
Reporter: Ramin Farajpour Cami | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Template system | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
Hi,

i see on django admin panle anything Whitespace control Jinja2 ,so i think
django can not support defulat whitespace control, this means
`trim_blocks` and `lstrip_blocks enabled` is disbale,

Jinja2 WhiteSpace Control is what you need :
http://jinja.pocoo.org/docs/templates/#whitespace-control

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

Django

unread,
Oct 12, 2016, 8:16:59 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: new
Cleanup/optimization |

Component: Template system | Version: 1.10
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
-------------------------------------+-------------------------------------
Changes (by Ramin Farajpour Cami):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> Hi,
>
> i see on django admin panle anything Whitespace control Jinja2 ,so i
> think django can not support defulat whitespace control, this means
> `trim_blocks` and `lstrip_blocks enabled` is disbale,
>
> Jinja2 WhiteSpace Control is what you need :
> http://jinja.pocoo.org/docs/templates/#whitespace-control

New description:

Hi,

i see on django admin panle,there isn't Whitespace control on jinja2
template ,so i think django can not support defulat whitespace control,


this means `trim_blocks` and `lstrip_blocks enabled` is disbale,

Jinja2 WhiteSpace Control is what you need :
http://jinja.pocoo.org/docs/templates/#whitespace-control

--

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

Django

unread,
Oct 12, 2016, 8:21:43 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: new
Cleanup/optimization |
Component: Template system | Version: 1.10
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 Tim Graham):

Could you give more details about the problem, including steps to
reproduce?

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

Django

unread,
Oct 12, 2016, 8:28:23 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: closed
Cleanup/optimization |

Component: Template system | Version: 1.10
Severity: Normal | Resolution:
| worksforme
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 Aymeric Augustin):

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


Comment:

You can pass arbitrary options such as `trim_blocks` to
`jinja2.Environment` by putting them in `OPTIONS`:
https://docs.djangoproject.com/en/1.10/topics/templates/#django.template.backends.jinja2.Jinja2

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

Django

unread,
Oct 12, 2016, 8:30:16 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: closed
Cleanup/optimization |
Component: Template system | Version: 1.10
Severity: Normal | Resolution:
| worksforme
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 Ramin Farajpour Cami):

* Attachment "123213.PNG" added.

Django

unread,
Oct 12, 2016, 8:30:51 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: new
Cleanup/optimization |

Component: Template system | Version: 1.10
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
-------------------------------------+-------------------------------------
Changes (by Ramin Farajpour Cami):

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


Comment:

Steps :

1- Go to http://127.0.0.1:8000/admin/auth/user/

2- right click browser inspect-element on header message `WELCOME, Test.
VIEW SITE / CHANGE PASSWORDUSER-TOOLSLOG OUT`

3- you see many space from render (Attach image) ,

--
Ticket URL: <https://code.djangoproject.com/ticket/27336#comment:4>

Django

unread,
Oct 12, 2016, 8:38:39 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: closed
Cleanup/optimization |

Component: Template system | Version: 1.10
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


Comment:

The Django admin uses the Django template language (and its behavior won't
be changed as #2594 says), not Jinja2.

--
Ticket URL: <https://code.djangoproject.com/ticket/27336#comment:5>

Django

unread,
Oct 12, 2016, 8:43:05 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: closed
Cleanup/optimization |
Component: Template system | Version: 1.10
Severity: Normal | Resolution: wontfix
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 Ramin Farajpour Cami):

* resolution: invalid => wontfix


--
Ticket URL: <https://code.djangoproject.com/ticket/27336#comment:6>

Django

unread,
Oct 12, 2016, 8:46:12 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: closed
Cleanup/optimization |
Component: Template system | Version: 1.10
Severity: Normal | Resolution: wontfix
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):

It's amazing that the admin renders at all with Jinja2.

--
Ticket URL: <https://code.djangoproject.com/ticket/27336#comment:7>

Django

unread,
Oct 12, 2016, 8:49:34 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration Jinja2
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: closed
Cleanup/optimization |
Component: Template system | Version: 1.10
Severity: Normal | Resolution: wontfix
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 Ramin Farajpour Cami):

Replying to [comment:7 Aymeric Augustin]:


> It's amazing that the admin renders at all with Jinja2.

can you explain why use django template language?

--
Ticket URL: <https://code.djangoproject.com/ticket/27336#comment:8>

Django

unread,
Oct 12, 2016, 8:54:52 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration template

-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: closed
Cleanup/optimization |
Component: Template system | Version: 1.10
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/27336#comment:9>

Django

unread,
Oct 12, 2016, 10:16:01 AM10/12/16
to django-...@googlegroups.com
#27336: Whitespace control django configuration template
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: nobody
Cami |
Type: | Status: closed
Cleanup/optimization |
Component: Template system | Version: 1.10
Severity: Normal | Resolution: wontfix
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):

Well I'm not sure what needs to be explained... The Django admin uses the
Django template language, that's it...

It was implemented before Jinja2 existed and 10 years before Django added
first class support for Jinja2.

--
Ticket URL: <https://code.djangoproject.com/ticket/27336#comment:10>

Reply all
Reply to author
Forward
0 new messages