We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5ef1089 commit 5397afdCopy full SHA for 5397afd
1 file changed
osf/admin.py
@@ -325,13 +325,17 @@ class Media:
325
js = ['admin/notification_subscription.js']
326
327
def preview_button(self, obj):
328
- url = reverse(
329
- 'admin:notificationtype_preview',
330
- args=[obj.notification_type.id]
331
- )
+ if obj.notification_type:
+ url = reverse(
+ 'admin:notificationtype_preview',
+ args=[obj.notification_type.id]
332
+ )
333
+ return format_html(
334
+ '<a class="button" target="_blank" href="{}">Preview</a>',
335
+ url
336
337
return format_html(
- '<a class="button" target="_blank" href="{}">Preview</a>',
- url
338
+ '<a class="button">Missing Notification Type!</a>',
339
)
340
341
def get_urls(self):
0 commit comments