v1.0a1 serializes additional_data log entry field as string
See original GitHub issueAfter upgrading Django from 2.2 to 3.1.1 and django-auditlog from 0.4.7 to v1.0a1 I now have to json.loads(log_entry["additional_data"]) to get the same result as log_entry["additional_data"] before. Is this an intentional change?
Also, django 3.1 has a built-in JSONField which we’d probably want to use when available.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
marshmallow - Read the Docs
marshmallow, Release 3.0.0a1 class UserSchema(Schema): name = fields.String(required=True) age = fields.Integer(required=True).
Read more >Arrow Columnar Format — Apache Arrow v10.0.1
When serializing Arrow data for interprocess communication, these alignment ... A record batch's field names and types collectively form the batch's schema.
Read more >STILTS - Starlink Tables Infrastructure Library Tool Set
STILTS parameters as are supplied as named arguments of the python functions. In general they are either table objects for table input ......
Read more >Unity 2023.1.0a23
First seen in 2023.1.0a1. Editor: Fixed serious Editor performance issue when running on macOS Ventura. (UUM-19011)
Read more >CTFd/CHANGELOG.md at master - GitHub
Fix issue where custom field entries for Users and Teams would be ... Challenge Topics are small topic strings which are only visible...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

What is the status on this and https://github.com/jazzband/django-auditlog/pull/271? I looked through the issues and this appears to me to be the only blocker for releasing a stable 1.0 version on pypi? While this issue is important, so is keeping up to date with the mainstream Django version and the latest stable release of
django-auditlogsupports neither 3.0 nor 3.1. It would be great to resolve this quickly and to getdjango-auditlogcompatible with mainstream Django 3.1. I’d be happy to contribute a patch if you point me in the right direction and there is a chance for it to get merged.IMO it’s unavoidable to move away from
django-jsonfield(as that one won’t get 3.1 compatibility) and, as stated above, there are two options:additional_dataformat unchanged on db level, by switching fromjsonfield.JSONFieldtomodels.TextFieldand pull (de-)serialization into django auditlog. Admittedly a slight degradation, but does the job.LogEntry, just for keeping the non-essentialadditional_datafield compatible.Either route is fine, but since
additional_datais not a central feature of auditlog, it seems sensible to first change it to aTextFieldwith manual json handling, just to kill thedjango-jsonfielddependency and to get a releaseddjango-auditlogthat is compatible with both mainstream (3.1) and LTS Django (2.2).In a later release, the
LogEntrymodel can be migrated to benefit from the newmodels.JSONFieldon all relevant fields (changes,additional_data,…), along with dropping Django 2.2./3.0 support for that new release.@jezdez @chrisittner are you guys aware that for Postgres db
django-jsonfieldcreatesjsonbfield ? https://github.com/adamchainz/django-jsonfield/blame/master/jsonfield/fields.py#L75 i.e. no matter if we changeadditional_datatoTextFieldor to djangoJSONField, some databases will be affected and db migration will be needed anyway.To me switching to
JSONFieldlooks like a natural choice going forward. Most databases and Django now supportJSONFieldout of the box and it is handy for querying data inside of it. I understand the concern of having to do potentially lengthy migration, though. I am wondering if it would make sense to avoid it. For example, we could try to make a migration with 2 actions:additional_data=>additional_data_oldadditional_dataadditional_data_oldwould be only in migration, not inLogEntrymodel. I assume Django allows to craft such migration. This way no data migration will be performed, yet all old data would still be available, and people could decide by themselves if they want to copy data fromadditional_data_oldtoadditional_datacolumn, or just dropadditional_data_old. Or they can just stick to using older version ofdjango-auditlog. Seems like a good compromise to move the project forward. If you guys ok with the idea, I am happy to prepare a PR.