Django already has a widespread convention of using ?next=/foo/ through Login and Signup (eg. see django-allauth). Might be a nice idea to support passing query parameters through the flow and keeping them when redirecting user to signup.
Example implementation (only for ?next)
from django.shortcuts import redirect
from django.urls import reverse
from invitations.views import AcceptInvite
class CustomAcceptInvite(AcceptInvite):
def post(self, *args, **kwargs):
r = super().post(*args, **kwargs)
_next = self.request.GET.get("next")
if r.url == reverse(self.get_signup_redirect()) and _next:
return redirect(f"{r.url}?next={_next}")
return r
Django already has a widespread convention of using
?next=/foo/
through Login and Signup (eg. see django-allauth). Might be a nice idea to support passing query parameters through the flow and keeping them when redirecting user to signup.Example implementation (only for
?next
)