add auto datetime and year

This commit is contained in:
Noretsa 2023-11-15 13:57:17 +03:00
parent 6d4f77a92a
commit 64fba789d0
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,6 @@
from flask import Flask, render_template from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
app = Flask(__name__, static_folder='static', static_url_path='') app = Flask(__name__, static_folder='static', static_url_path='')
@ -30,6 +31,11 @@ menu = [
] ]
@app.context_processor
def inject_now():
return {'now': datetime.utcnow()}
@app.route("/") @app.route("/")
@app.route("/home") @app.route("/home")
def home(): def home():

View File

@ -153,7 +153,7 @@
<!-- Copyright --> <!-- Copyright -->
<div class="text-center p-3" style="background-color: rgba(0, 0, 0, 0.2);"> <div class="text-center p-3" style="background-color: rgba(0, 0, 0, 0.2);">
© {{ moment().format('YYYY') }} Copyright: © {{ now.year }} Copyright:
<a class="text-dark" href="http://klintorg.ru">klintorg.ru</a> <a class="text-dark" href="http://klintorg.ru">klintorg.ru</a>
</div> </div>
<!-- Copyright --> <!-- Copyright -->