From d68f30db8b3c9e07dfc0e06a5bdbde3c10696b66 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Mon, 25 Apr 2022 16:09:06 +0200 Subject: [PATCH] Add transkribus models --- app/models.py | 12 ++++++++---- ...custom_types.py => sqlalchemy_type_decorators.py} | 0 2 files changed, 8 insertions(+), 4 deletions(-) rename app/{sqlalchemy_custom_types.py => sqlalchemy_type_decorators.py} (100%) diff --git a/app/models.py b/app/models.py index 84bf7b3c..7604d82c 100644 --- a/app/models.py +++ b/app/models.py @@ -1,6 +1,6 @@ from app import db, login from app.converters.vrt import normalize_vrt_file -from app.sqlalchemy_custom_types import ContainerColumn, IntEnumColumn +from app.sqlalchemy_type_decorators import ContainerColumn, IntEnumColumn from datetime import datetime, timedelta from enum import IntEnum from flask import current_app, url_for @@ -461,10 +461,14 @@ class TranskribusHTRModel(HashidMixin, db.Model): @staticmethod def insert_defaults(): user = User.query.filter_by(username='nopaque').first() + # models = [ + # m for m in TRANSKRIBUS_HTR_MODELS if True + # and 'creator' in m and m['creator'] == 'Transkribus Team' + # and 'docType' in m and m['docType'] == 'handwritten' + # ] models = [ - m for m in TRANSKRIBUS_HTR_MODELS if True - and 'creator' in m and m['creator'] == 'Transkribus Team' - and 'docType' in m and m['docType'] == 'handwritten' + m for m in TRANSKRIBUS_HTR_MODELS + if m['modelId'] in [35909, 33744, 33597, 29820, 37789, 13685, 37855, 26124, 37738, 30919, 34763] ] for m in models: model = TranskribusHTRModel.query.filter_by(transkribus_model_id=m['modelId']).first() # noqa diff --git a/app/sqlalchemy_custom_types.py b/app/sqlalchemy_type_decorators.py similarity index 100% rename from app/sqlalchemy_custom_types.py rename to app/sqlalchemy_type_decorators.py