mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
Disabled admin interface from settings.py
This commit is contained in:
parent
ba2c2e32be
commit
456b17eb8b
3 changed files with 17 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from functools import cached_property
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
|
@ -9,7 +10,6 @@ from auditlog.mixins import LogEntryAdminMixin
|
|||
from auditlog.models import LogEntry
|
||||
|
||||
|
||||
@admin.register(LogEntry)
|
||||
class LogEntryAdmin(admin.ModelAdmin, LogEntryAdminMixin):
|
||||
list_select_related = ["content_type", "actor"]
|
||||
list_display = [
|
||||
|
|
@ -57,3 +57,7 @@ class LogEntryAdmin(admin.ModelAdmin, LogEntryAdminMixin):
|
|||
def get_queryset(self, request):
|
||||
self.request = request
|
||||
return super().get_queryset(request=request)
|
||||
|
||||
|
||||
if not settings.AUDITLOG_DISABLE_ADMIN_INTERFACE:
|
||||
admin.site.register(LogEntry, LogEntryAdmin)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ settings.AUDITLOG_DISABLE_ON_RAW_SAVE = getattr(
|
|||
settings, "AUDITLOG_DISABLE_ON_RAW_SAVE", False
|
||||
)
|
||||
|
||||
# Disable django admin interface
|
||||
settings.AUDITLOG_DISABLE_ADMIN_INTERFACE = getattr(
|
||||
settings, "AUDITLOG_DISABLE_ADMIN_INTERFACE", False
|
||||
)
|
||||
|
||||
# CID
|
||||
|
||||
settings.AUDITLOG_CID_HEADER = getattr(
|
||||
|
|
|
|||
|
|
@ -463,3 +463,10 @@ Django Admin integration
|
|||
|
||||
When ``auditlog`` is added to your ``INSTALLED_APPS`` setting a customized admin class is active providing an enhanced
|
||||
Django Admin interface for log entries.
|
||||
|
||||
|
||||
If you want to not register the django admin interface, you can set the following setting:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
AUDITLOG_DISABLE_ADMIN_INTERFACE = True
|
||||
|
|
|
|||
Loading…
Reference in a new issue