diff --git a/app.py b/app.py index d51509d..a691a3f 100644 --- a/app.py +++ b/app.py @@ -3,7 +3,7 @@ from flask import Flask, render_template, request, redirect, url_for, session, s from PIL import Image from gen_image import gen_image from config import * -from datetime import datetime +from datetime import * from print import * from process_image import * from file_handler import * @@ -44,6 +44,19 @@ templates = { "pos": 130 }, "cut": True + }, + "Remove by": { + "text1": { + "string": "Remove by", + "size": 130, + "pos": 0 + }, + "text2": { + "string": "", + "size": 50, + "pos": 130 + }, + "cut": True } } @@ -140,9 +153,13 @@ def text_template(): if request.method == 'POST': template = templates[request.form["template"]] + if request.form["template"] == "Food": template["text2"]["string"] = datetime.now().strftime('%Y-%m-%d') + if request.form["template"] == "Remove by": + template["text2"]["string"] = (datetime.now() + timedelta(weeks=3)).strftime('%Y-%m-%d') + session["text1"] = template["text1"] session["text2"] = template["text2"] session["cut"] = template["cut"] diff --git a/templates/image.html b/templates/image.html index 1a4f2f5..c23ffe6 100644 --- a/templates/image.html +++ b/templates/image.html @@ -6,7 +6,7 @@
{% if info %} diff --git a/templates/text.html b/templates/text.html index bcb3f1b..02a0f7b 100644 --- a/templates/text.html +++ b/templates/text.html @@ -8,6 +8,7 @@