mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-05-28 00:24:09 +00:00
16 lines
436 B
Python
16 lines
436 B
Python
from decimal import Decimal
|
|
|
|
from django.core.serializers.json import DjangoJSONEncoder
|
|
|
|
AUDITLOG_BUGGY_REPR_DATATYPES = (Decimal,)
|
|
|
|
|
|
class AuditLogChangesJSONEncoder(DjangoJSONEncoder):
|
|
def default(self, obj):
|
|
if isinstance(obj, list) and obj:
|
|
return [
|
|
str(o) if isinstance(o, AUDITLOG_BUGGY_REPR_DATATYPES) else o
|
|
for o in obj
|
|
]
|
|
|
|
return super().default(obj)
|