fix: modification visuel du frontend au niveau du formulaire de contact pour qu'il s'armonise avec le css global.
fix : update du backend avec ajout de la suppression d'un projet.
This commit is contained in:
parent
ef1ba911d9
commit
542e00482b
9 changed files with 68 additions and 15 deletions
|
|
@ -26,8 +26,16 @@ def update_entry(filename, entry_id, new_entry):
|
|||
return new_entry
|
||||
return None
|
||||
|
||||
def delete_entry(filename, entry_id):
|
||||
data = load_json(filename)
|
||||
new_data = [item for item in data if item.get('id') != entry_id]
|
||||
save_json(filename, new_data)
|
||||
return len(data) != len(new_data)
|
||||
def delete_entry(filename, project_id):
|
||||
# 1. Charger les données
|
||||
with open(filename, "r", encoding="utf-8") as f:
|
||||
projects = json.load(f)
|
||||
|
||||
# 2. Filtrer pour supprimer le projet avec l'ID donné
|
||||
updated_projects = [p for p in projects if p.get('id') != int(project_id)]
|
||||
|
||||
# 3. Sauvegarder les données mises à jour
|
||||
with open(filename, "w", encoding="utf-8") as f:
|
||||
json.dump(updated_projects, f, indent=2, ensure_ascii=False)
|
||||
|
||||
return {"status": "success", "deleted_id": project_id}
|
||||
Loading…
Add table
Add a link
Reference in a new issue