forked from orbit-oss/flask
add sqlite datetime converter
This commit is contained in:
parent
df201ed152
commit
8aa161a437
2 changed files with 14 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import sqlite3
|
||||
from datetime import datetime
|
||||
|
||||
import click
|
||||
from flask import current_app
|
||||
|
|
@ -44,6 +45,9 @@ def init_db_command():
|
|||
click.echo("Initialized the database.")
|
||||
|
||||
|
||||
sqlite3.register_converter("timestamp", lambda v: datetime.fromisoformat(v.decode()))
|
||||
|
||||
|
||||
def init_app(app):
|
||||
"""Register database functions with the Flask app. This is called by
|
||||
the application factory.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue