From d34a9b96e92312b118e41bbc81b3683787ac5be0 Mon Sep 17 00:00:00 2001 From: Topvennie Date: Mon, 8 Apr 2024 15:06:49 +0200 Subject: [PATCH] chore: move signal --- backend/api/apps.py | 6 ------ backend/api/signals.py | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/backend/api/apps.py b/backend/api/apps.py index 55a607c6..878e7d54 100644 --- a/backend/api/apps.py +++ b/backend/api/apps.py @@ -4,9 +4,3 @@ class ApiConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "api" - - def ready(self): - from authentication.signals import user_created - from api.signals import user_creation - - user_created.connect(user_creation) diff --git a/backend/api/signals.py b/backend/api/signals.py index f6e2ddc5..fec0206a 100644 --- a/backend/api/signals.py +++ b/backend/api/signals.py @@ -1,9 +1,11 @@ from api.models.student import Student from authentication.models import User +from authentication.signals import user_created from django.dispatch import Signal, receiver # TODO: Is this a signal? +@receiver(user_created) def user_creation(user: User, attributes: dict, **_): """Upon user creation, auto-populate additional properties""" student_id: str = attributes.get("ugentStudentID")