From 159feb38e49376fe954a5cc52e3c2a8ff210c0a5 Mon Sep 17 00:00:00 2001 From: nikolaswollenberg Date: Fri, 2 Feb 2024 08:56:04 +0100 Subject: [PATCH] Added dragndrop --- models/Habit.py | 3 + templates/index.html | 117 ++++++++++++++++++++++++++++++++++-- templates/layouts/main.html | 5 +- 3 files changed, 120 insertions(+), 5 deletions(-) diff --git a/models/Habit.py b/models/Habit.py index 4b6c65e..221934d 100644 --- a/models/Habit.py +++ b/models/Habit.py @@ -1,3 +1,4 @@ +import json from dataclasses import dataclass from datetime import datetime @@ -108,3 +109,5 @@ class Habit: self.percentage = int(count / self.times * 100) + def to_json(self): + return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True, indent=4) diff --git a/templates/index.html b/templates/index.html index f00d2ea..c61e2dc 100644 --- a/templates/index.html +++ b/templates/index.html @@ -89,9 +89,12 @@ -