Tuesday, October 23, 2012

Re: Stop executing template tag

Thanks to all . But Tome and Russel answers were absolutely correct.Worked like a charm.

{% templatetag openvariable %} hello {% templatetag closevariable




On Fri, Oct 19, 2012 at 4:16 PM, Russell Keith-Magee <russell@keith-magee.com> wrote:
On Fri, Oct 19, 2012 at 6:21 PM, Nikhil Verma <varma.nikhil22@gmail.com> wrote:
> Hello people
>
> I need some suggestion in a problem.
>
> How can i stop django template engine  not executing {{name}}. Meaning I do
> not want that {{}}, the value should be printed it should somehow pass into
> the browser as it is.
> If i writing {{name}} it should print {{name}} in html file/browser

You have two options:

Option 1 - Use the {% templatetag %} templatetag:

https://docs.djangoproject.com/en/dev/ref/templates/builtins/#templatetag

{% templatetag openvariable %} hello {% templatetag closevariable

will render as

{{ hello }}

Option 2 -- if you have a large block of text that you want to render,
you can use the {% verbatim %} template tag

{% verbatim %}
This {{ content }} won't be processed.
{% endverbatim %}

Unfortunately, this option is only available in Django's trunk (so it
will be part of Django 1.5). However, there are plenty of snippets of
code you can use (including copying Django's own implementation) that
you can use in your own project.

Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--
Regards
Nikhil Verma
+91-958-273-3156

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate