A common pattern (and one that is used by the Django admin site) is to use something like a next querystring parameter. The view code can detect if the next parameter exists and redirect to that page if it does.
Here’s an example from one of my projects where I applied this pattern.
<a href="{% url "courses:task_edit" uuid=task.uuid %}?next={{ request.path|urlencode }}">