Finally I've understood how Gitea templates works

This commit is contained in:
DarkCat09 2023-02-16 18:25:40 +04:00
parent 51e04f9f0f
commit 103f628bb2
4 changed files with 7 additions and 7 deletions

View file

@ -1,5 +1,4 @@
flaskapp/* flaskapp/app.py
static/* flaskapp/db.py
templates/* db/schema.sql
Makefile .env
requirements.txt

View file

@ -30,7 +30,7 @@ class RouteAdmin(routes.Routes):
cur = db.get_cursor() cur = db.get_cursor()
cur.execute( cur.execute(
'insert into ${REPO_NAME_SNAKE} ' f'insert into {db.TABLE} '
'(email,name,age) values (%s,%s,%s)', '(email,name,age) values (%s,%s,%s)',
( (
form.email.data, form.email.data,

View file

@ -9,6 +9,7 @@ from pymysql.cursors import Cursor
from . import exts from . import exts
TABLE = '${REPO_NAME_SNAKE}'
db_obj: List[Optional[Connection]] = [None] db_obj: List[Optional[Connection]] = [None]

View file

@ -19,7 +19,7 @@ class RoutePages(routes.Routes):
def table(): def table():
cur = db.get_cursor() cur = db.get_cursor()
cur.execute('SELECT * FROM ${REPO_NAME_SNAKE}') cur.execute(f'SELECT * FROM {db.TABLE}')
rows = cur.fetchall() rows = cur.fetchall()
cur.close() cur.close()