support multiple paths in move DBox via new StoragePathNames() function, and pass that through to jinja

This commit is contained in:
2021-06-24 17:33:42 +10:00
parent a412164ef7
commit 0a5e837236
2 changed files with 9 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ from wtforms import SubmitField, StringField, HiddenField, SelectField, IntegerF
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
from status import st, Status from status import st, Status
from shared import CreateSelect, CreateFoldersSelect, LocationIcon, DB_URL from shared import CreateSelect, CreateFoldersSelect, LocationIcon, DB_URL
import re import re
import socket import socket
@@ -33,6 +34,7 @@ from person import Person
from refimg import Refimg from refimg import Refimg
from job import Job, GetNumActiveJobs from job import Job, GetNumActiveJobs
from ai import aistats from ai import aistats
from path import StoragePathNames
####################################### GLOBALS ####################################### ####################################### GLOBALS #######################################
# allow jinja2 to call these python functions directly # allow jinja2 to call these python functions directly
@@ -46,6 +48,7 @@ app.jinja_env.globals['ClearJM_Message'] = ClearJM_Message
app.jinja_env.globals['CreateSelect'] = CreateSelect app.jinja_env.globals['CreateSelect'] = CreateSelect
app.jinja_env.globals['CreateFoldersSelect'] = CreateFoldersSelect app.jinja_env.globals['CreateFoldersSelect'] = CreateFoldersSelect
app.jinja_env.globals['LocationIcon'] = LocationIcon app.jinja_env.globals['LocationIcon'] = LocationIcon
app.jinja_env.globals['StoragePathNames'] = StoragePathNames
# default page, just the navbar # default page, just the navbar
@app.route("/", methods=["GET"]) @app.route("/", methods=["GET"])

View File

@@ -28,3 +28,9 @@ class Path(db.Model):
def __repr__(self): def __repr__(self):
return f"<id: {self.id}, path_prefix: {self.path_prefix}, num_files={self.num_files}, type={self.type}>" return f"<id: {self.id}, path_prefix: {self.path_prefix}, num_files={self.num_files}, type={self.type}>"
def StoragePathNames():
ret=[]
sps=Path.query.join(PathType).filter(PathType.name=='Storage').all()
for p in sps:
ret.append(p.path_prefix.replace('static/Storage/','') )
return ret