From 597824f09f92a6229f9c87c678b1f8b2dfc0716d Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 22 Jan 2018 12:28:14 +0100 Subject: [PATCH] Fix admin base for non-notification models --- pgweb/util/admin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pgweb/util/admin.py b/pgweb/util/admin.py index 60a5f00d..21e2b8da 100644 --- a/pgweb/util/admin.py +++ b/pgweb/util/admin.py @@ -26,7 +26,7 @@ class PgwebAdmin(admin.ModelAdmin): return fld def change_view(self, request, object_id, form_url='', extra_context=None): - if self.model.send_notification: + if hasattr(self.model, 'send_notification') and self.model.send_notification: # Anything that sends notification supports manual notifications if extra_context == None: extra_context = dict() @@ -54,7 +54,7 @@ class PgwebAdmin(admin.ModelAdmin): actions=['custom_delete_selected'] def save_model(self, request, obj, form, change): - if change and self.model.send_notification: + if change and hasattr(self.model, 'send_notification') and self.model.send_notification: # We only do processing if something changed, not when adding # a new object. if request.POST.has_key('new_notification') and request.POST['new_notification']: