#19479 closed Bug (duplicate)
The {% include with...%} template tag does not accept boolean as value
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Template system | Version: | 1.4 |
| Severity: | Normal | Keywords: | |
| Cc: | charette.s@… | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Folks, the following doesn't work:
{% include "some_template.html" with param=True %}
param is not available in some_template.html If I use a number in param, it works.
Change History (1)
comment:1 by , 13 years ago
| Cc: | added |
|---|---|
| Resolution: | → duplicate |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Couldn't reproduce against master:
simon@imac:~$ mktmpenv New python executable in d58d6e9f-7c22-429a-9052-e34bf4642c03/bin/python Installing distribute.............................................................................................................................................................................................done. Installing pip...............done. virtualenvwrapper.user_scripts creating /home/simon/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/bin/predeactivate virtualenvwrapper.user_scripts creating /home/simon/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/bin/postdeactivate virtualenvwrapper.user_scripts creating /home/simon/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/bin/preactivate virtualenvwrapper.user_scripts creating /home/simon/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/bin/postactivate virtualenvwrapper.user_scripts creating /home/simon/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/bin/get_env_details This is a temporary environment. It will be deleted when you run 'deactivate'. (d58d6e9f-7c22-429a-9052-e34bf4642c03)simon@imac:~/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03$ pip install https://github.com/django/django/archive/master.zip Downloading/unpacking https://github.com/django/django/archive/master.zip Downloading master.zip (11.5Mb): 11.5Mb downloaded Running setup.py egg_info for package from https://github.com/django/django/archive/master.zip warning: no previously-included files matching '__pycache__' found under directory '*' warning: no previously-included files matching '*.py[co]' found under directory '*' Installing collected packages: Django Running setup.py install for Django changing mode of build/scripts-2.7/django-admin.py from 664 to 775 warning: no previously-included files matching '__pycache__' found under directory '*' warning: no previously-included files matching '*.py[co]' found under directory '*' changing mode of /home/simon/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/bin/django-admin.py to 775 Successfully installed Django Cleaning up... (d58d6e9f-7c22-429a-9052-e34bf4642c03)simon@imac:~/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03$ django-admin.py startproject ticket_19479 (d58d6e9f-7c22-429a-9052-e34bf4642c03)simon@imac:~/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03$ cd ticket_19479/ (d58d6e9f-7c22-429a-9052-e34bf4642c03)simon@imac:~/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/ticket_19479$ mkdir templates (d58d6e9f-7c22-429a-9052-e34bf4642c03)simon@imac:~/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/ticket_19479$ echo "{% if param %}works{% endif %}" > templates/included (d58d6e9f-7c22-429a-9052-e34bf4642c03)simon@imac:~/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/ticket_19479$ echo "{% include \"included\" with param=True %}" > templates/includer (d58d6e9f-7c22-429a-9052-e34bf4642c03)simon@imac:~/.virtualenvs/d58d6e9f-7c22-429a-9052-e34bf4642c03/ticket_19479$ python Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from django.conf import settings >>> import os >>> settings.configure(DEBUG=True, TEMPLATE_DEBUG=True, TEMPLATE_DIRS=(os.path.join(os.getcwd(), 'templates'),)) >>> from django.template.loader import render_to_string >>> render_to_string('includer') u'works\n\n'Prior to django 1.5 the
True,FalseandNoneliterals weren't resolving to their Python equivalent in the template system.That's the reason why it doesn't work for you here. For more details see #17229.
Closing as duplicate.