Skip to content

Commit

Permalink
create cohort user when creating an invite profile academy
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavomm19 committed Nov 1, 2024
1 parent b0af3e6 commit 727cc25
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion breathecode/authenticate/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 727cc25

Please sign in to comment.