Skip to content

Commit

Permalink
Merge pull request #144 from opencivicdata/3.2-model-permissions
Browse files Browse the repository at this point in the history
has_add_permissions needs to take an obj argument
  • Loading branch information
fgregg authored May 15, 2024
2 parents 0e0b55c + 582b60c commit d5520de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions opencivicdata/core/admin/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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


Expand Down
2 changes: 1 addition & 1 deletion opencivicdata/core/admin/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit d5520de

Please sign in to comment.