mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
Disable add button in admin ui
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
This commit is contained in:
parent
a93f53962a
commit
cdd9f40d84
3 changed files with 6 additions and 1 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#### Fixes
|
||||
|
||||
- Fix inconsistent changes with JSONField ([#355](https://github.com/jazzband/django-auditlog/pull/355))
|
||||
- Disable `add` button in admin ui ([#378](https://github.com/jazzband/django-auditlog/pull/378))
|
||||
|
||||
## 2.0.0 (2022-05-09)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,5 +22,9 @@ class LogEntryAdmin(admin.ModelAdmin, LogEntryAdminMixin):
|
|||
("Changes", {"fields": ["action", "msg"]}),
|
||||
]
|
||||
|
||||
def has_add_permission(self, request):
|
||||
# As audit admin doesn't allow log creation from admin
|
||||
return False
|
||||
|
||||
|
||||
admin.site.register(LogEntry, LogEntryAdmin)
|
||||
|
|
|
|||
|
|
@ -933,7 +933,7 @@ class AdminPanelTest(TestCase):
|
|||
res = self.client.get("/admin/auditlog/logentry/")
|
||||
assert res.status_code == 200
|
||||
res = self.client.get("/admin/auditlog/logentry/add/")
|
||||
assert res.status_code == 200
|
||||
assert res.status_code == 403
|
||||
res = self.client.get(f"/admin/auditlog/logentry/{log_pk}/", follow=True)
|
||||
assert res.status_code == 200
|
||||
res = self.client.get(f"/admin/auditlog/logentry/{log_pk}/delete/")
|
||||
|
|
|
|||
Loading…
Reference in a new issue