I’ve two different views (for instance, one for colors and other for cars )
That views point to the same template.
If you click in one color, the template will show all the information about the color selected, same thing whit the car.
What I’m trying to do is to insert a button to go back:
<form action="">
{% ifequal back_to colors %}
<a href="/browse/colors/" style= "text-decoration: none">
<input type="button" value="Go back"></input></a>
{% endifequal %}
{% ifequal back_to cars %}
<a href="/browse/cars" style= "text-decoration: none">
<input type="button" value="Go back"></input></a>
{% endifequal %}
</form>
where in the view colors I pass ‘back_to’: ‘colors’ and view cars ‘back_to’:’cars’.
The results is that I have two buttons to go back in both pages.
What I wanted was if I was in color page, only the button to go back to page where I select colors, and if I was in car page, only the button to go back to the page I select cars.
Hope I made my point, if someone how to do this, I’ll be grateful.
If you can guarantee that there are only two options (cars or colors) then you can do the following:
Also the above snippet can be simplified to:
Update
Deniz Dogan makes a good point about using reverse.