Skip to content

Commit 87c7e4a

Browse files
committed
Notifications: fix rendering
In #11094 we introduce a bug in the rendering because we stopped initializing the Message class with the `format_values` from the `Notification` object itself. That's why all the notifications weren't rendering these values.
1 parent 06140a3 commit 87c7e4a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

readthedocs/notifications/models.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from django.utils.translation import gettext_noop as _
88
from django_extensions.db.models import TimeStampedModel
99

10-
1110
from .constants import CANCELLED, DISMISSED, READ, UNREAD, WARNING
1211
from .messages import Message, registry
1312
from .querysets import NotificationQuerySet
@@ -67,9 +66,12 @@ def __str__(self):
6766

6867
def get_message(self):
6968
# Pass the instance attached to this notification
70-
format_values = {
71-
"instance": self.attached_to,
72-
}
69+
format_values = self.format_values or {}
70+
format_values.update(
71+
{
72+
"instance": self.attached_to,
73+
}
74+
)
7375

7476
message = registry.get(self.message_id, format_values=format_values)
7577
if message is None:

0 commit comments

Comments
 (0)