Skip to content

Commit

Permalink
fix: invalid template rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 authored and alanzhu0 committed Oct 27, 2024
1 parent b227f6e commit f80a619
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
14 changes: 12 additions & 2 deletions intranet/apps/eighth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from django.db import models, transaction
from django.db.models import Count, Manager, Q, QuerySet
from django.http.request import HttpRequest
from django.urls import reverse
from django.utils import formats, timezone
from sentry_sdk import add_breadcrumb, capture_exception
from simple_history.models import HistoricalRecords
Expand Down Expand Up @@ -1140,11 +1141,16 @@ def set_sticky_students(self, users: "Sequence[AbstractBaseUser]") -> None:

self.sticky_students.set(users)

base_url = reverse("eighth_signup", args=[self.block.id])
if new_stickied_students:
email_send_task.delay(
"eighth/emails/students_stickied.txt",
"eighth/emails/students_stickied.html",
data={"activity": self},
data={
"activity": self.activity,
"block": self.block,
"base_url": base_url,
},
subject="You have been stickied into an activity",
emails=new_stickied_students,
bcc=True,
Expand All @@ -1153,7 +1159,11 @@ def set_sticky_students(self, users: "Sequence[AbstractBaseUser]") -> None:
email_send_task.delay(
"eighth/emails/students_unstickied.txt",
"eighth/emails/students_unstickied.html",
data={"activity": self},
data={
"activity": self.activity,
"block": self.block,
"base_url": base_url,
},
subject="You have been unstickied from an activity",
emails=unstickied_students,
bcc=True,
Expand Down
2 changes: 1 addition & 1 deletion intranet/templates/eighth/emails/students_stickied.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% endwith %}

<p>
You have been stickied into {{ activity.activity.name }} on {{ activity.date }} ({{ activity.block_letter }}).
You have been stickied into {{ activity.name }} on {{ block.date }} ({{ block.block_letter }}).
</p>

{% include "email_footer.txt" %}
Expand Down
2 changes: 1 addition & 1 deletion intranet/templates/eighth/emails/students_stickied.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
You have been stickied into {{ activity.activity.name }} on {{ activity.date }} ({{ activity.block_letter }}).
You have been stickied into {{ activity.name }} on {{ block.date }} ({{ block.block_letter }}).
2 changes: 1 addition & 1 deletion intranet/templates/eighth/emails/students_unstickied.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% endwith %}

<p>
You have been unstickied from {{ activity.activity.name }} on {{ activity.date }} ({{ activity.block_letter }}).
You have been unstickied from {{ activity.name }} on {{ block.date }} ({{ block.block_letter }}).
Please select a new eighth period to sign up for.
<br>
Have a nice day!
Expand Down
2 changes: 1 addition & 1 deletion intranet/templates/eighth/emails/students_unstickied.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
You have been unstickied from {{ activity.activity.name }} on {{ activity.date }} ({{ activity.block_letter }}).
You have been unstickied from {{ activity.name }} on {{ block.date }} ({{ block.block_letter }}).
Please select a new eighth period to sign up for.

Have a nice day!

0 comments on commit f80a619

Please sign in to comment.