On Wed, Jan 8, 2014 at 9:33 AM, luca72 <[email protected]> wrote:
> hello the views file is like:
>
> def test(request):
> testo = ["a","b"]
> titolo = 'test'
> variabile = 'one'
> return render_to_response('vini.html',{'testo':testo,'titolo':titolo,
> 'testo':testo,'variabile':variabile,})
>
> the template is:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <link rel="stylesheet" type="text/css"
> href="http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx/piemontestatic/admin/css/principale.css"/>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> <title>{% block title %}{{titolo}}{% endblock %}</title>
> </head>
> <body>
> <div id="titoli">
> {% block titoli %} {% endblock %}
> </div>
> <div id="navcontainer">
> <ul id="navlist">
> {% if {{variabile}} == "one" %}
> <li id="active"><a href="/mostro_prima" id="current">History</a></li>
> <li><a href="/vini">Wines</a></li>
> <li><a href="#">Foods</a></li>
> {% elif {{variabile}} == "two" %}
> <li><a href="/mostro_prima">History</a></li>
> <li id="active"><a href="/vini" id="current">Wines</a></li>
> <li><a href="#">Foods</a></li>
> {% else %}
> <li><a href="/mostro_prima">History</a></li>
> <li><a href="/vini">Wines</a></li>
> <li id="active"><a href="#" id="current">Foods</a></li>
> {% endif %}
> </ul>
> </div>
> <div id="main">
> {% block main %}{% for n in testo %}<br/>{{n}}{% endfor %}
> <br/><br/><br/>
> Contact : <br/>
> Tel: +xxxxxxxxxx </br>
> Mobile: +xxxxxxxxx2<br/>
> Email : <a href="xxxxxxxxxxxxxxxxxxxxxxx"> info@xxxxxxxxxxxxxxxxxm</a>
> {% endblock %}
> </div>
> <div id= "immagini">
> </div>
> </body>
> </html>
>
> Why i get the error how i can solve?
You do not need the {{ }} around context variables when they
referenced inside a template tag. Change
{% if {{variabile}} == "one" %}
to:
{% if variabile == "one" %}
and do the same for the elif.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CACwCsY53WtDJLdvk4dBgdfOeJsntcv%3Df2%3D3_ECWpePbT%2BNFx6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.