我想request.META.get('HTTP_REFERER')
在模板中使用。
我的模板来源:
<!-- this is login.html -->
{% extends "base.html" %}
{% block title %}django bookmark- login{% endblock %}
{% block head %}login{% endblock %}
{% block content %}
{% if form.errors %}
<p>try again!</p>
{% endif %}
<form method="post" action=".">{% csrf_token %}
<p><label for="id_username">username:</label>
{{ form.username }}</p>
<p><label for="id_password">password:</label>
{{ form.password }}</p>
<input type="hidden" name="next" value="/<!-- I WANT TO USE 'HTTP_REFERER' HERE -->" />
<input type="submit" value="login" />
</form>
{% endblock %}
我该怎么办?
urlpatterns = patterns('', (r'^login/$', 'django.contrib.auth.views.login'),