I have the following column definition in my model:
... created_on = db.Column(UTCDateTime, nullable=False, default=now_utc)
In my controller, I eventually call json.dump() on a list that contains created_on values (ex:
datetime.datetime(2020, 4, 26, 10, 18, 13, tzinfo=<UTC>)), to return it as JSON serialized back to a DataTable (https://datatables.net/) data source axaj call.
Unfortunately, I get the following Exception:
TypeError: datetime.datetime(2020, 4, 26, 10, 18, 13, tzinfo=<UTC>) is not JSON serializable
Now, I know I could use something like this to “fix” the problem https://code-maven.com/serialize-datetime-object-as-json-in-python, but was wondering if there was a cleaner, Indico-nic way of doing it.