Skip to content

Commit 5397afd

Browse files
committed
fix issue with subscriptions without types
1 parent 5ef1089 commit 5397afd

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

osf/admin.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,17 @@ class Media:
325325
js = ['admin/notification_subscription.js']
326326

327327
def preview_button(self, obj):
328-
url = reverse(
329-
'admin:notificationtype_preview',
330-
args=[obj.notification_type.id]
331-
)
328+
if obj.notification_type:
329+
url = reverse(
330+
'admin:notificationtype_preview',
331+
args=[obj.notification_type.id]
332+
)
333+
return format_html(
334+
'<a class="button" target="_blank" href="{}">Preview</a>',
335+
url
336+
)
332337
return format_html(
333-
'<a class="button" target="_blank" href="{}">Preview</a>',
334-
url
338+
'<a class="button">Missing Notification Type!</a>',
335339
)
336340

337341
def get_urls(self):

0 commit comments

Comments
 (0)