django-auditlog | A Django app that keeps a log of changes made to an object
kandi X-RAY | django-auditlog Summary
kandi X-RAY | django-auditlog Summary
A Django app that keeps a log of changes made to an object.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Register a model
- Creates log_m2m_changes
- Connect signals to auditlog
- Create a new log entry
- Returns serialized data or None
- Creates a deep copy of the given instance
- Return the pk value of the primary key
- Mask fields in a dict
- Return a list of model fields to include
- Convert a value into a string
- Log M2M changes
- Log an update
- Returns the difference between two model instances
- Get the value of the given field
- Returns whether the given field is tracking
- Return a list of fields in the model
- Returns a queryset of objects for the given model instance
- Create a log entry
- Log a delete event
django-auditlog Key Features
django-auditlog Examples and Code Snippets
Community Discussions
Trending Discussions on django-auditlog
QUESTION
I have created a simple Django application to display individual articles. These articles have a number of fields that users can edit. I am using the package 'django-auditlog' to log changes to these article models. So far, I have simply followed the auditlog installation doc to setup model history tracking (as well as enabling the middleware to allow 'actor_id' to be tracked). I have also added the example code that displays the most recent changes on the individual model pages as such:
...ANSWER
Answered 2022-Mar-25 at 19:20I figured out the answer after looking through the models file for Django AuditLog. It is not possible to pull the actor out directly from the history field of the model if you have created the history field using the AuditlogHistoryField() method as described in the django-auditlog tutorial.
Instead, I did the following:
In the views.py file
QUESTION
I am using an awesome library called Django Auditlog. It tracks what changes occurred to an object. For model Book if I changed the Author name from 'John' to 'Mary' it records the before value (John), after value (Mary), when it occurred, and what user made the change.
It's working except that it is detecting changes that aren't changes for some of my decimal fields. It thinks a change occurs anytime I save this model: it thinks that I started with .00 and changed it to .0. But .00 is the existing value and I didn't change anything. I just saved() the record.
I checked the output of the form itself in the clean() method:
...ANSWER
Answered 2020-Sep-02 at 22:56If you look up into source you would see that it compares these two values not as field values but through use of smart_text values are converted to string inside get_field_value
So it basically compares "44.00" and your value of "44.0" and this is different string so it is triggered as change
Not sure if this is by design as in my eyes would be considered bug, and you could fork and fix it yourself
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-auditlog
You can use django-auditlog like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page