環境
Python 3.5.0
Django 1.9.2
template.html
<form action="./?next={{ request.META.HTTP_REFERER }}" method="post">{% csrf_token %}
ケーキの数: {{ cake_form.cake_num }}
<input type="submit" value="送信">
</form>
views.py
from django.shortcuts import redirect
if 'next' in request.GET:
return redirect(request.GET['next'])