itplanning/ITPlanning/api/__init__.py
2021-06-21 22:31:24 +02:00

27 lines
650 B
Python

from flask import Blueprint
from flask.json import JSONEncoder
from datetime import datetime
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
from .errors import *
from .appointement import *
from .planning import *
from .service import *
from .ticket import *
from .user import *