test redesign gesthub
This commit is contained in:
65
web/init_db.py
Normal file
65
web/init_db.py
Normal file
@@ -0,0 +1,65 @@
|
||||
from app import app, db, Block
|
||||
import json
|
||||
|
||||
# Configuration des widgets actuels extraits de ton index.html
|
||||
initial_blocks = [
|
||||
# 1. Colonne GAUCHE : Le Planning
|
||||
Block(
|
||||
block_type='iframe',
|
||||
column_name='left',
|
||||
position=0,
|
||||
data=json.dumps({
|
||||
"title": "Planning / Agenda",
|
||||
"url": "https://mattermost.ninolbt.com/boards/team/8xj6d4ukwigk7rznqi3w339x7e/b3kmbqfwd33dmdy9g9g3ezaoxza/vu4nuxhf73ircznrkrcgzonno8a",
|
||||
"height": "100%",
|
||||
"styleClass": "planning"
|
||||
})
|
||||
),
|
||||
# 2. Colonne CENTRALE : Le Trello (Board)
|
||||
Block(
|
||||
block_type='iframe',
|
||||
column_name='center',
|
||||
position=0,
|
||||
data=json.dumps({
|
||||
"title": "",
|
||||
"url": "https://mattermost.ninolbt.com/boards/team/8xj6d4ukwigk7rznqi3w339x7e/b3kmbqfwd33dmdy9g9g3ezaoxza/va5xp53m6spbi8qo6qnng7711me",
|
||||
"height": "680",
|
||||
"styleClass": "trello"
|
||||
})
|
||||
),
|
||||
# 3. Colonne DROITE : Les boutons
|
||||
Block(
|
||||
block_type='buttons',
|
||||
column_name='right',
|
||||
position=0,
|
||||
data=json.dumps({
|
||||
"links": [
|
||||
{"label": "Projet", "url": "#"},
|
||||
{"label": "GDD Global", "url": "#"},
|
||||
{"label": "Bible 3D Art", "url": "#"},
|
||||
{"label": "Bible GameDev", "url": "#"},
|
||||
{"label": "Réglement du HUB", "url": "#"}
|
||||
]
|
||||
})
|
||||
)
|
||||
]
|
||||
|
||||
def init_data():
|
||||
with app.app_context():
|
||||
# Crée les tables si elles n'existent pas encore
|
||||
db.create_all()
|
||||
|
||||
# Vérifie si la DB est déjà remplie pour éviter les doublons
|
||||
if Block.query.first():
|
||||
print("La base de données contient déjà des blocs.")
|
||||
return
|
||||
|
||||
print("Injection des widgets par défaut...")
|
||||
for block in initial_blocks:
|
||||
db.session.add(block)
|
||||
|
||||
db.session.commit()
|
||||
print("Terminé ! Tes widgets sont en base de données.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
init_data()
|
||||
Reference in New Issue
Block a user