tags:

views:

223

answers:

2

All,

Can t we do the following in templates

{% if subject.id == selected_id %}

and also cannot we assign variable like {{selected="selected"}}

Thank........

A: 

Not as shown. Use the ifequal and with template tags instead.

Ignacio Vazquez-Abrams
Can u give me an example......
Hulk
+3  A: 

This comparison will work in Django 1.2. For 1.1 you have to use ifequal:

{% ifequal subject.id  selected_id %}

For variable assignment you can use with.

{% with selected as 'selected' %}

{% endwith %}

Don't hesitate to read the documentation, it doesn't hurt.

Felix Kling
Thanks.....................
Hulk