Django permission_required decorator doesn't redirect back after login

My request handlers have a permission_required decorator to force the user to login. Like so:

@permission_required("main.view_things", login_url="admin/login")
def homepage(request):
    # ...

This works fine. But if a login is required, the login page doesn't redirect back to the original page (here: homepage), but to some page in admin. Is there an easy fix, since this seems to be a pretty standard situation?

Back to Top