0

My problem: A user gets an email with qrcode, the qrcode links to a website. But when the user is not logged in he cant reach the linked site (because of the login requirement). I managed to redirect to the requested path after log in. However i want this to work also if the user is not registered yet, so user gets the qr link, but has to register first. Then after registration he will be redirected to the clicked url of the qr.

What i have for the redirection after login:

settings.py add the following code:

EMPLATE_CONTEXT_PROCESSORS = (
    "django.core.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.request",
)

in base.html add the following code:

<a href="{% url "login" %}?next={{request.path}}" style="margin-left: 20px">Login</a>

How can i write the code so that after registration the user is directed to the requested url.

Sander
  • 51
  • 6

1 Answers1

0

Have you considered using 'next' to redirect to the original QR code page after a login post form if the user is not authed?

Here is a link with the how-to.

  • tx, i managed it to redirect to the requested url, i changed my question with the code. However i want to redirect also after registration of the user. At this moment its only redirecting after login. – Sander Mar 17 '21 at 06:52