Skip to content

Commit f80a619

Browse files
JasonGrace2282alanzhu0
authored andcommitted
fix: invalid template rendering
1 parent b227f6e commit f80a619

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

intranet/apps/eighth/models.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from django.db import models, transaction
1717
from django.db.models import Count, Manager, Q, QuerySet
1818
from django.http.request import HttpRequest
19+
from django.urls import reverse
1920
from django.utils import formats, timezone
2021
from sentry_sdk import add_breadcrumb, capture_exception
2122
from simple_history.models import HistoricalRecords
@@ -1140,11 +1141,16 @@ def set_sticky_students(self, users: "Sequence[AbstractBaseUser]") -> None:
11401141

11411142
self.sticky_students.set(users)
11421143

1144+
base_url = reverse("eighth_signup", args=[self.block.id])
11431145
if new_stickied_students:
11441146
email_send_task.delay(
11451147
"eighth/emails/students_stickied.txt",
11461148
"eighth/emails/students_stickied.html",
1147-
data={"activity": self},
1149+
data={
1150+
"activity": self.activity,
1151+
"block": self.block,
1152+
"base_url": base_url,
1153+
},
11481154
subject="You have been stickied into an activity",
11491155
emails=new_stickied_students,
11501156
bcc=True,
@@ -1153,7 +1159,11 @@ def set_sticky_students(self, users: "Sequence[AbstractBaseUser]") -> None:
11531159
email_send_task.delay(
11541160
"eighth/emails/students_unstickied.txt",
11551161
"eighth/emails/students_unstickied.html",
1156-
data={"activity": self},
1162+
data={
1163+
"activity": self.activity,
1164+
"block": self.block,
1165+
"base_url": base_url,
1166+
},
11571167
subject="You have been unstickied from an activity",
11581168
emails=unstickied_students,
11591169
bcc=True,

intranet/templates/eighth/emails/students_stickied.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% endwith %}
66

77
<p>
8-
You have been stickied into {{ activity.activity.name }} on {{ activity.date }} ({{ activity.block_letter }}).
8+
You have been stickied into {{ activity.name }} on {{ block.date }} ({{ block.block_letter }}).
99
</p>
1010

1111
{% include "email_footer.txt" %}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
You have been stickied into {{ activity.activity.name }} on {{ activity.date }} ({{ activity.block_letter }}).
1+
You have been stickied into {{ activity.name }} on {{ block.date }} ({{ block.block_letter }}).

intranet/templates/eighth/emails/students_unstickied.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% endwith %}
66

77
<p>
8-
You have been unstickied from {{ activity.activity.name }} on {{ activity.date }} ({{ activity.block_letter }}).
8+
You have been unstickied from {{ activity.name }} on {{ block.date }} ({{ block.block_letter }}).
99
Please select a new eighth period to sign up for.
1010
<br>
1111
Have a nice day!
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
You have been unstickied from {{ activity.activity.name }} on {{ activity.date }} ({{ activity.block_letter }}).
1+
You have been unstickied from {{ activity.name }} on {{ block.date }} ({{ block.block_letter }}).
22
Please select a new eighth period to sign up for.
33

44
Have a nice day!

0 commit comments

Comments
 (0)