forked from CGM_Public/pretix_original
Logging: Automatically serialize file objects
Sentry PRETIXEU-RY
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from django.core.files import File
|
||||
from i18nfield.utils import I18nJSONEncoder
|
||||
|
||||
from pretix.base.reldate import RelativeDateWrapper
|
||||
@@ -7,6 +8,8 @@ class CustomJSONEncoder(I18nJSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, RelativeDateWrapper):
|
||||
return obj.to_string()
|
||||
elif isinstance(obj, File):
|
||||
return obj.name
|
||||
else:
|
||||
return super().default(obj)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user