Add custom JSON encoder to handle attachment objects
This commit is contained in:
9
atst/utils/json.py
Normal file
9
atst/utils/json.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from flask.json import JSONEncoder
|
||||
from atst.models.attachment import Attachment
|
||||
|
||||
|
||||
class CustomJSONEncoder(JSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, Attachment):
|
||||
return obj.filename
|
||||
return JSONEncoder.default(self, obj)
|
Reference in New Issue
Block a user