#27336 closed Cleanup/optimization (wontfix)
Whitespace control django configuration template
| Reported by: | Ramin Farajpour Cami | Owned by: | nobody |
|---|---|---|---|
| Component: | Template system | Version: | 1.10 |
| Severity: | Normal | 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 (last modified by )
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
Attachments (1)
Change History (11)
comment:1 by , 9 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
| Resolution: | → worksforme |
|---|---|
| Status: | new → closed |
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
by , 9 years ago
| Attachment: | 123213.PNG added |
|---|
comment:4 by , 9 years ago
| Resolution: | worksforme |
|---|---|
| Status: | closed → new |
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) ,
comment:5 by , 9 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
The Django admin uses the Django template language (and its behavior won't be changed as #2594 says), not Jinja2.
comment:6 by , 9 years ago
| Resolution: | invalid → wontfix |
|---|
comment:8 by , 9 years ago
Replying to Aymeric Augustin:
It's amazing that the admin renders at all with Jinja2.
can you explain why use django template language?
comment:9 by , 9 years ago
| Summary: | Whitespace control django configuration Jinja2 → Whitespace control django configuration template |
|---|
comment:10 by , 9 years ago
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.
Could you give more details about the problem, including steps to reproduce?