added filter fpr length in list and transactionlist
This commit is contained in:
parent
a6dd6310b7
commit
b8f54c497e
3 changed files with 18 additions and 3 deletions
|
@ -10,6 +10,13 @@ preis = -150 #Ein Getraenk
|
|||
#flask_config
|
||||
DATABASE = './Website/mate.db'
|
||||
|
||||
def limit_length(text, length=50):
|
||||
if type(text) != str:
|
||||
text = str(text)
|
||||
if len(text) > length:
|
||||
return f"{text[:(length -3)]}..."
|
||||
return text
|
||||
|
||||
def create_app(test_config=None):
|
||||
app = Flask(__name__)
|
||||
key = str(uuid.uuid4().hex)
|
||||
|
@ -17,6 +24,7 @@ def create_app(test_config=None):
|
|||
app.config['SESSION_TYPE'] = 'filesystem'
|
||||
app.config['SECRET_KEY'] = key
|
||||
app.config['DATABASE'] = DATABASE
|
||||
app.jinja_env.filters['limit_length'] = limit_length
|
||||
else:
|
||||
app.config.from_mapping(test_config)
|
||||
|
||||
|
@ -34,7 +42,7 @@ def create_app(test_config=None):
|
|||
# db = getattr(g, '_database', None)
|
||||
# if db is not None:
|
||||
# db.close()
|
||||
# app.logger.info("Website exited")
|
||||
# appt.logger.info("Website exited")
|
||||
|
||||
#var
|
||||
user_queue = queue.Queue()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue