django, ident previous page for usage in a template -


i want page content vary depending on page user came from. how possible define previous page use in template? mean should

{% if (previous page)=="/some/page/"%} {% endif %} 

what have write instead of (previous page)? wonder if can use request.meta['http_referer'] somehow, because attempts called errors.

django's template language not python , doesn't support python's subscript syntax. have use request.meta.http_referer documented here : https://docs.djangoproject.com/en/dev/topics/templates/#variables

also http referer meta not reliable might safest using sessions track users navigation.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -