Skip to content

Commit

Permalink
Revert "Disallow changing or deleting log entries" (#496)
Browse files Browse the repository at this point in the history
This reverts commit de5638c.
  • Loading branch information
aleh-rymasheuski authored Jan 16, 2023
1 parent 2a93c20 commit 6996e1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Next Release

#### Fixes

- fix: revert [#449](https://github.com/jazzband/django-auditlog/pull/449) "Make log entries read-only in the admin" as it breaks deletion of any auditlogged model through the admin when `AuditlogHistoryField` is used. ([#496](https://github.com/jazzband/django-auditlog/pull/496))

## 2.2.1 (2022-11-28)

#### Fixes
Expand Down
7 changes: 1 addition & 6 deletions auditlog/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,5 @@ class LogEntryAdmin(admin.ModelAdmin, LogEntryAdminMixin):
]

def has_add_permission(self, request):
return False

def has_change_permission(self, request, obj=None):
return False

def has_delete_permission(self, request, obj=None):
# As audit admin doesn't allow log creation from admin
return False
2 changes: 1 addition & 1 deletion auditlog_tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ def test_auditlog_admin(self):
res = self.client.get(f"/admin/auditlog/logentry/{log_pk}/", follow=True)
self.assertEqual(res.status_code, 200)
res = self.client.get(f"/admin/auditlog/logentry/{log_pk}/delete/")
self.assertEqual(res.status_code, 403)
self.assertEqual(res.status_code, 200)
res = self.client.get(f"/admin/auditlog/logentry/{log_pk}/history/")
self.assertEqual(res.status_code, 200)

Expand Down

0 comments on commit 6996e1c

Please sign in to comment.