Django-allauth: user_signed_up signal does not seem to work

Created on 2 Aug 2013  路  1Comment  路  Source: pennersr/django-allauth

I am having difficulty getting the user_signed_up signal to work. It is set up per the Django Documentation, but it's not working. The file which the receiver resides is inside app/signals.py and the app is the first listed on INSTALLED_APPS to ensure that it is registered (as per the docs).

Here is my apps/signals.py file:

from allauth.account.signals import user_signed_up
from django.contrib.auth.models import Group
from django.dispatch import receiver

@receiver(user_signed_up)
def after_user_signed_up(sender, request, user):
    g = Group.objects.get(name='regular')
    user.groups.add(g)

This is not adding the user to the group as it should. I am not sure, but from the looks of here and here, it seems as though Allauth is sending the user object saved from the form as indicated here and documented here.

Most helpful comment

Figured it out. I moved it to app/models.py and it all worked out.

>All comments

Figured it out. I moved it to app/models.py and it all worked out.

Was this page helpful?
0 / 5 - 0 ratings