itplanning/ITPlanning/api/__init__.py

27 lines
650 B
Python
Raw Normal View History

2021-05-25 19:01:20 +00:00
from flask import Blueprint
2021-06-21 20:30:50 +00:00
from flask.json import JSONEncoder
from datetime import datetime
2021-05-25 19:01:20 +00:00
2021-06-21 20:30:50 +00:00
class CustomJsonEncoder(JSONEncoder):
def default(self, obj):
try:
if isinstance(obj, datetime):
return obj.strftime("%Y-%m-%dT%H%M")
iterable = iter(obj)
except TypeError:
pass
else:
return list(iterable)
return JSONEncoder.default(self, obj)
api = Blueprint("api", __name__)
api.json_encoder = CustomJsonEncoder
2021-05-30 09:05:19 +00:00
from .errors import *
2021-05-25 19:01:20 +00:00
from .appointement import *
from .planning import *
from .service import *
from .ticket import *
from .user import *