0

I am using django-auditlog for creating entries in LogEntry table. my actions for User Model are not getting logged in LogEntry table.

my User model -

class User(AbstractUser):
...
...
...

username = None

USERNAME_FIELD = 'id'
REQUIRED_FIELDS = []

objects = UserManager()

def __str__(self):
  return f"{self.email}"

...
...

auditlog.register(User)

*I have to use django-auditlog only so pls suggest accordigly

TIA

2 Answers2

2

I use django-auditlog version 2.1.1. In my case, I've solved it this way:

AUDITLOG_INCLUDE_TRACKING_MODELS = (
    {
        "model": "auth.User",
        "exclude_fields": ["last_login"],
    },
)

I hope that it was useful!

0

choose 1 models.py in any app and import user model

ex. from django.contrib.auth.models import User

then register the user to auditlog

auditlog.register(User)