views:

153

answers:

2

Inline template

In my template can I use a <a href> tag? I want that if there is a field named 'id' it should give a href link over there. I have tried following options:

1){% ifequal field.field.label "Id" %}

<a href =../../{{field.field}}>click here </a>

2){% ifequal field.field.label "Id" %}

<a href ="../../{{field.field}}">click here </a>

3){% ifequal field.field.label "Id" %}

<a href =../../{{field.field.value}}>click here </a>

4){% ifequal field.field.label "Id" %}

<a href ="../../"{{field.field}}>click here </a>

5){% ifequal field.field.label "Id" %}

<a href ={{field.field}}>click here </a>

In this case it is showing the address of the current page. Means not showing the value of field.field.

All the options do not work. It is not showing the value of field.field in href.field.field.label shows Id in href when I displays the value field.field

{{field.field}} it is showing correct value.

A: 

I'd say {% if field.id %} {%endif%} should be enough (or field.field.id or field.field, depending on what's the inner structure).

Almad
+1  A: 

Use {% url %} instead of composing your own href values.

Ignacio Vazquez-Abrams