Skip to content

Commit

Permalink
Trying a new callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Mann committed Nov 17, 2024
1 parent ce0c7be commit 6ba36ac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
16 changes: 16 additions & 0 deletions lesgrandsvoisins/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from allauth.account.signals import user_signed_up
from django.apps import AppConfig
from django.contrib.auth.models import Group


def user_signed_up_callback(sender, request, user, **kargs):
dashboard_user_group = Group.objects.get(name="dashboard")
user.groups.add(dashboard_user_group)


class LesGrandsVoisinsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "lesgrandsvoisins"

def ready(self):
user_signed_up.connect(user_signed_up_callback)
8 changes: 8 additions & 0 deletions lesgrandsvoisins/settings/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from allauth.account.signals import user_signed_up
from django.contrib.auth.models import Group


@receiver(user_signed_up)
def user_signed_up_callback(sender, request, user, **kargs):
dashboard_user_group = Group.objects.get(name="dashboard")
user.groups.add(dashboard_user_group)
10 changes: 0 additions & 10 deletions lesgrandsvoisins/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@
from django.core.wsgi import get_wsgi_application


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


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lesgrandsvoisins.settings.production")


application = get_wsgi_application()


# @receiver(user_signed_up)
# def user_signed_up_callback(sender, request, user, **kargs):
# dashboard_user_group = Group.objects.get(name="dashboard")
# user.groups.add(dashboard_user_group)

0 comments on commit 6ba36ac

Please sign in to comment.