Skip to content

Commit

Permalink
Merge pull request #1490 from gustavomm19/add-cohort-user
Browse files Browse the repository at this point in the history
create cohort user when creating an invite profile academy
  • Loading branch information
tommygonzaleza authored Nov 4, 2024
2 parents 6037e56 + 727cc25 commit f88ced0
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 @@ -14,7 +14,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 f88ced0

Please sign in to comment.