From 64d3e3e4cdcd03fd6f4babc91bc80f5ac40e5a26 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sun, 10 Jan 2021 13:41:36 +1100 Subject: [PATCH] Settings class now uses sequence, the DB sequence and table have been created and commented out a simple settings addition for now -- Beware it runs twice with Flask in DEV mode --- TODO | 3 ++- main.py | 3 +++ settings.py | 11 ++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index adde716..3f6eff4 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,8 @@ * probably need a "batch" processing system that uses ionice to minimise load on mara ### UI - * basic browse a + * use native file dialog box to set import_path in a "settings page" + * basic browse the import path ### AI * store reference images diff --git a/main.py b/main.py index fdfd7e4..a311b93 100644 --- a/main.py +++ b/main.py @@ -26,6 +26,9 @@ db = SQLAlchemy(app) ma = Marshmallow(app) Bootstrap(app) +################################# Now, import non-book classes ################################### +from settings import Settings + ####################################### GLOBALS ####################################### # allow jinja2 to call these python functions directly diff --git a/settings.py b/settings.py index a20df26..8180bc5 100644 --- a/settings.py +++ b/settings.py @@ -10,9 +10,14 @@ from status import st, Status # Class describing Author in the database, and via sqlalchemy, connected to the DB as well ################################################################################ class Settings(db.Model): - id = db.Column(db.Integer, db.Sequence('fs_id_seq'), primary_key=True ) - name = db.Column(db.String, unique=True, nullable=True ) - value = db.Column(db.String, unique=True, nullable=True ) + id = db.Column(db.Integer, db.Sequence('settings_id_seq'), primary_key=True ) + name = db.Column(db.String, unique=True, nullable=True ) + value = db.Column(db.String, unique=True, nullable=True ) def __repr__(self): return "".format(self.id, self.name, self.value) + +### modify the below to add a import path, assumption will be there is only 1 ever import_path, it will have : separated values +#s = Settings( name="import_path", value="/home/ddp/src/photoassistant/images_to_process" ) +#db.session.add(s) +#db.session.commit()