Fix landing-page css
This commit is contained in:
@@ -3,7 +3,7 @@ import sqlite3
|
||||
import os
|
||||
from tools.utils import gen_token
|
||||
from flask_bcrypt import Bcrypt
|
||||
|
||||
from markupsafe import escape
|
||||
app = Flask( 'pywallter' )
|
||||
bcrypt = Bcrypt(app)
|
||||
|
||||
@@ -36,6 +36,7 @@ def init_db(database):
|
||||
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS Blog_posts(
|
||||
title_id TEXT,
|
||||
title TEXT NOT NULL,
|
||||
subtitle TEXT,
|
||||
comments TEXT,
|
||||
@@ -45,7 +46,7 @@ def init_db(database):
|
||||
category TEXT,
|
||||
author TEXT,
|
||||
status TEXT,
|
||||
PRIMARY KEY(title, author)
|
||||
PRIMARY KEY(title_id, author)
|
||||
)
|
||||
""")
|
||||
conn.commit()
|
||||
@@ -83,7 +84,8 @@ def db_migrate(database):
|
||||
updated_col = False
|
||||
creation_date_col = False
|
||||
content_col = False
|
||||
|
||||
title_id_col = False
|
||||
|
||||
conn = sqlite3.connect(database)
|
||||
cursor = conn.cursor()
|
||||
|
||||
@@ -111,7 +113,8 @@ def db_migrate(database):
|
||||
creation_date_col= True
|
||||
if "category" == col[0]:
|
||||
category_col= True
|
||||
|
||||
if "title_id" == col[0]:
|
||||
title_id_col = True
|
||||
|
||||
if not(invitations_col):
|
||||
cursor.execute("""ALTER TABLE users ADD COLUMN invitations INTEGER DEFAULT (20);""")
|
||||
@@ -152,9 +155,49 @@ def db_migrate(database):
|
||||
conn.commit()
|
||||
print ("Time renomé en creation_date")
|
||||
|
||||
if not(category_col):
|
||||
cursor.execute("""ALTER TABLE Blog_posts ADD COLUMN category TEXT;""")
|
||||
conn.commit()
|
||||
print ("Ajout de la colono category")
|
||||
if not(category_col):
|
||||
cursor.execute("""ALTER TABLE Blog_posts ADD COLUMN category TEXT;""")
|
||||
conn.commit()
|
||||
print ("Ajout de la colono category")
|
||||
|
||||
|
||||
if not(title_id_col):
|
||||
cursor.execute("""SELECT title, subtitle, content, creation_date, category, comments, last_updated, author, status FROM Blog_posts;""")
|
||||
list_posts=cursor.fetchall()
|
||||
cursor.execute("""DROP TABLE Blog_posts""")
|
||||
conn.commit()
|
||||
cursor.execute("""
|
||||
CREATE TABLE Blog_posts(
|
||||
title_id TEXT,
|
||||
title TEXT NOT NULL,
|
||||
subtitle TEXT,
|
||||
comments TEXT,
|
||||
content TEXT,
|
||||
creation_date TEXT,
|
||||
last_updated TEXT,
|
||||
category TEXT,
|
||||
author TEXT,
|
||||
status TEXT,
|
||||
PRIMARY KEY(title_id, author)
|
||||
)
|
||||
""")
|
||||
conn.commit()
|
||||
if list_posts != None:
|
||||
for post in list_posts:
|
||||
title_id=escape(post[0])
|
||||
title = post[0]
|
||||
subtitle = post[1]
|
||||
content = post[2]
|
||||
creation_date = post[3]
|
||||
category = post[4]
|
||||
comments = post[5]
|
||||
last_updated = post[6]
|
||||
author = post[7]
|
||||
status = post[8]
|
||||
cursor.execute("""INSERT INTO Blog_posts(title_id, title, subtitle, category, content, creation_date, last_updated, author, status)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)""", (title_id, title, subtitle, category, content, creation_date, last_updated, author, status))
|
||||
#Après le for on commit les transations
|
||||
conn.commit()
|
||||
print ("migration de l'anciene base de donnée de blog")
|
||||
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user