mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
enable use of replica database
When you use replica database the django-auditlog try to write in the same database where object was read (replica). But this is a read only database and crash the application. This changes saves always in the default database. If you want to save in multiple databases or in a special one use `DATABASE_ROUTERS` to configure it.
This commit is contained in:
parent
665217d32f
commit
6c70783174
1 changed files with 1 additions and 7 deletions
|
|
@ -67,13 +67,7 @@ class LogEntryManager(models.Manager):
|
|||
content_type=kwargs.get("content_type"),
|
||||
object_pk=kwargs.get("object_pk", ""),
|
||||
).delete()
|
||||
# save LogEntry to same database instance is using
|
||||
db = instance._state.db
|
||||
return (
|
||||
self.create(**kwargs)
|
||||
if db is None or db == ""
|
||||
else self.using(db).create(**kwargs)
|
||||
)
|
||||
return self.create(**kwargs)
|
||||
return None
|
||||
|
||||
def get_for_object(self, instance):
|
||||
|
|
|
|||
Loading…
Reference in a new issue