mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
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 i18nfield.utils import I18nJSONEncoder
|
||||||
|
|
||||||
from pretix.base.reldate import RelativeDateWrapper
|
from pretix.base.reldate import RelativeDateWrapper
|
||||||
@@ -7,6 +8,8 @@ class CustomJSONEncoder(I18nJSONEncoder):
|
|||||||
def default(self, obj):
|
def default(self, obj):
|
||||||
if isinstance(obj, RelativeDateWrapper):
|
if isinstance(obj, RelativeDateWrapper):
|
||||||
return obj.to_string()
|
return obj.to_string()
|
||||||
|
elif isinstance(obj, File):
|
||||||
|
return obj.name
|
||||||
else:
|
else:
|
||||||
return super().default(obj)
|
return super().default(obj)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user