1👍
✅
Redirect has a different method signature:
redirect("app:submission_thanks", data=survey.data.slug, survey=survey.slug)
See shortcut redirect examples in the Django docs.
Diving into the code a little: redirect(to, *args, **kwargs)
calls resolve_url(to, *args, **kwargs)
which calls urlresolvers.reverse(to, args=args, kwargs=kwargs)
. So this is definitely correct.
You do not need to wrap the args
in a list or kwargs
in a dictionary when using the resolve_url
or redirect
shortcut.
0👍
Pass reversed url in redirect:
return redirect(
reverse("app:submission_thanks",
kwargs={ "data": survey.data.slug, "survey": survey.slug }))
Source:stackexchange.com