From 727cc25d9d26e1530a8639eeb05e3f7133c9fa91 Mon Sep 17 00:00:00 2001 From: gustavomm19 Date: Fri, 1 Nov 2024 08:54:42 +0000 Subject: [PATCH] create cohort user when creating an invite profile academy --- breathecode/authenticate/serializers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/breathecode/authenticate/serializers.py b/breathecode/authenticate/serializers.py index 123f47966..c1bf22a0d 100644 --- a/breathecode/authenticate/serializers.py +++ b/breathecode/authenticate/serializers.py @@ -12,7 +12,7 @@ from task_manager.django.actions import schedule_task import breathecode.notify.actions as notify_actions -from breathecode.admissions.models import Academy, Cohort +from breathecode.admissions.models import Academy, Cohort, CohortUser from breathecode.authenticate.actions import get_app_url, get_user_settings from breathecode.authenticate.tasks import verify_user_invite_email from breathecode.events.models import Event @@ -952,6 +952,13 @@ def create(self, validated_data): ) profile_academy.save() + for c in cohort: + CohortUser.objects.create( + cohort=c, + role="STUDENT", + user=user, + ) + notify_actions.send_email_message( "academy_invite", email,