I want that users must fill out a form after the first login. With the signals I’ve already tried:
# -*- coding: utf-8 -*-
from django.contrib.auth.signals import user_logged_in
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
[...]
def umleiten(sender, user, request, **kwargs):
print reverse("first_login")
"""Check if a user logged on for the first time."""
return HttpResponseRedirect(reverse("first_login"))
user_logged_in.connect(umleiten)
The function “umleiten” is called but it will not be forwarded to the appropriate page.
Is there a way to call a function after the login from which I can forward to another site.
You can and probably should use middleware for that
Where, e.g. you’ve extended User with an object that has a BooleanField which gets checked once the user did what you’ve wanted them todo: