Skip to content

Commit cdfc9d1

Browse files
Add registration confirmation course details
1 parent 55a318d commit cdfc9d1

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

course_management/datamailer/payloads/registration_confirmations.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from dataclasses import dataclass
22
from typing import Any
33

4+
from django.utils.dateformat import format as format_date
5+
46
from course_management import email_templates
57

68
from ..client import DatamailerConfig
@@ -56,10 +58,16 @@ def registration_confirmation_course_context(course):
5658
context = {
5759
"course_title": "",
5860
"course_slug": "",
61+
"course_start_date": "",
5962
}
6063
if course is not None:
6164
context["course_title"] = course.title
6265
context["course_slug"] = course.slug
66+
if course.start_date:
67+
context["course_start_date"] = format_date(
68+
course.start_date,
69+
"F j, Y",
70+
)
6371
return context
6472

6573

@@ -77,6 +85,10 @@ def registration_confirmation_context(registration, campaign, course, urls):
7785
"intro_text": (
7886
f"Your registration for {campaign.title} is confirmed."
7987
),
88+
"next_steps_text": (
89+
"Closer to the start, we will send you another email with "
90+
"more information about the course."
91+
),
8092
"notification_category": "course-related emails",
8193
"notification_footer": (
8294
"You are receiving this because course-related emails are "

courses/tests/test_datamailer_registration.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from unittest.mock import patch
22

3+
from django.utils.dateparse import parse_date
34
from django.test import TestCase, override_settings
45

56
from data.models import (
@@ -67,6 +68,7 @@ def create_llm_registration_for_confirmation():
6768
slug="llm-zoomcamp-2026",
6869
title="LLM Zoomcamp 2026",
6970
description="LLM course",
71+
start_date=parse_date("2026-09-14"),
7072
)
7173
campaign = RegistrationCampaign.objects.create(
7274
slug="llm-zoomcamp",
@@ -116,6 +118,17 @@ def assert_registration_confirmation_payload(
116118
payload["context"]["course_url"],
117119
"https://courses.example.com/llm-zoomcamp-2026/",
118120
)
121+
test_case.assertEqual(
122+
payload["context"]["course_start_date"],
123+
"September 14, 2026",
124+
)
125+
test_case.assertEqual(
126+
payload["context"]["next_steps_text"],
127+
(
128+
"Closer to the start, we will send you another email with "
129+
"more information about the course."
130+
),
131+
)
119132
test_case.assertEqual(payload["metadata"]["event"], "course_registration")
120133
test_case.assertEqual(
121134
payload["metadata"]["preference_key"],

0 commit comments

Comments
 (0)