From 73b0c0aac220f873a3fb1379d6418131e528e262 Mon Sep 17 00:00:00 2001 From: Forest Gregg Date: Fri, 28 Oct 2022 16:48:46 -0400 Subject: [PATCH 1/2] has_add_permissions needs to take an obj argument --- opencivicdata/core/admin/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opencivicdata/core/admin/base.py b/opencivicdata/core/admin/base.py index 4f122a5..1c0da43 100644 --- a/opencivicdata/core/admin/base.py +++ b/opencivicdata/core/admin/base.py @@ -12,7 +12,7 @@ def has_delete_permission(self, request, obj=None): return False # we probably don't want to add anything through the interface - def has_add_permission(self, request): + def has_add_permission(self, request, obj=None): return False # To ignore `DisallowedModelAdminLookup` error because of non @@ -22,7 +22,7 @@ def lookup_allowed(self, request, key): class ReadOnlyTabularInline(admin.TabularInline): - def has_add_permission(self, request): + def has_add_permission(self, request, obj=None): return False can_delete = False @@ -35,7 +35,7 @@ class IdentifierInline(admin.TabularInline): verbose_name = "ID from another system" verbose_name_plural = "IDs from other systems" - def has_add_permission(self, request): + def has_add_permission(self, request, obj=None): return False From 582b60c5ae305e0c11f8f759c750906c056390f6 Mon Sep 17 00:00:00 2001 From: Forest Gregg Date: Fri, 28 Oct 2022 16:49:55 -0400 Subject: [PATCH 2/2] also update has_add_permission in organization admin --- opencivicdata/core/admin/organization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opencivicdata/core/admin/organization.py b/opencivicdata/core/admin/organization.py index 8124b77..8705691 100644 --- a/opencivicdata/core/admin/organization.py +++ b/opencivicdata/core/admin/organization.py @@ -41,7 +41,7 @@ class PostInline(admin.TabularInline): can_delete = False show_change_link = True - def has_add_permission(self, request): + def has_add_permission(self, request, obj=None): return False