environnement Python 3.5.0 Django 1.9.2
template.html
<form action="./?next={{ request.META.HTTP_REFERER }}" method="post">{% csrf_token %}
Nombre de gâteaux: {{ cake_form.cake_num }}
<input type="submit" value="Envoyer">
</form>
views.py
from django.shortcuts import redirect
if 'next' in request.GET:
return redirect(request.GET['next'])
Recommended Posts