Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #449 "Disallow changing or deleting log entries" #496

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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