mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
16 lines
404 B
Python
16 lines
404 B
Python
from i18nfield.utils import I18nJSONEncoder
|
|
|
|
from pretix.base.reldate import RelativeDateWrapper
|
|
|
|
|
|
class CustomJSONEncoder(I18nJSONEncoder):
|
|
def default(self, obj):
|
|
if isinstance(obj, RelativeDateWrapper):
|
|
return obj.to_string()
|
|
else:
|
|
return super().default(obj)
|
|
|
|
|
|
def safe_string(original):
|
|
return original.replace("<", "\\u003C").replace(">", "\\u003E")
|