Skip to content

Commit 6e38c19

Browse files
committed
DBC22-6784: added alias to route_at, safe filter in email template
1 parent 644b874 commit 6e38c19

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

src/backend/apps/event/admin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from apps.cms.models import DriveBCMapWidget
22
from apps.event.models import Event, QueuedEventNotification
3-
from apps.event.tasks import queue_event_notifications
3+
from apps.event.tasks import queue_event_notifications, send_queued_notifications
44
from django.contrib.gis import admin
55

66

@@ -18,9 +18,15 @@ class EventAdmin(admin.GISModelAdmin):
1818
gis_widget = DriveBCMapWidget
1919

2020

21+
@admin.action(description="Send all queued notifications")
22+
def send_all_queued_notifications(modeladmin, request, queryset):
23+
send_queued_notifications()
24+
25+
2126
class QueuedEventNotificationAdmin(admin.ModelAdmin):
2227
readonly_fields = ('id', 'created_at', 'modified_at')
2328
list_display = ('id', 'event_id', 'route_id', 'created_at')
29+
actions = [send_all_queued_notifications]
2430

2531

2632
admin.site.register(QueuedEventNotification, QueuedEventNotificationAdmin)

src/backend/apps/event/templates/email/event_updated.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
{{ event.display_category_title }}
7979
</td>
8080
</tr>
81-
81+
8282
<tr>
8383
{% if event.severity == 'MAJOR' %}
8484
<td style="font-size: 1.25rem; font-weight:700; color:#D8292F; padding: 8px 12px 0">
@@ -92,7 +92,7 @@
9292
{% endif %}
9393
</td>
9494
</tr>
95-
95+
9696
{% if event.direction != 'NONE' %}
9797
<tr>
9898
<td style="font-size: 0.875rem; font-weight:700; color:#464341; padding: 8px 12px 0">
@@ -118,7 +118,7 @@
118118
Location
119119
</td>
120120
<td style="font-size: 0.875rem; vertical-align:top; padding: 12px 0 0 8px">
121-
{{ event.location_description }}
121+
{{ event.location_description|safe }}
122122
</td>
123123
</tr>
124124
<tr>

src/backend/apps/feed/serializers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ def to_internal_value(self, data):
228228
continue
229229

230230
# route_at - was "route-designator" but now "name"
231-
data['route_at'] = start_or_end.get('name', '')
231+
route_name = start_or_end.get('name', '')
232+
route_alias = start_or_end.get('alias')
233+
data['route_at'] = route_name + ', ' + route_alias if route_alias else route_name
232234

233235
# closest_landmark / location_description
234236
nearby_locs = start_or_end.get('nearby', [])

0 commit comments

Comments
 (0)