From d38d2ecb1c5739cb4fc174d4e1a7690c96fa2e46 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 11 Oct 2024 15:35:54 +0100 Subject: [PATCH] Store file path --- yamdl_playground/core/models.py | 2 ++ yamdl_playground/core/utils.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/yamdl_playground/core/models.py b/yamdl_playground/core/models.py index 67a9966..1c40d8e 100644 --- a/yamdl_playground/core/models.py +++ b/yamdl_playground/core/models.py @@ -7,6 +7,7 @@ class Tag(models.Model): __yamdl__ = True slug = models.SlugField(max_length=128, primary_key=True) + file_path = models.CharField(max_length=255) content = models.TextField() @@ -23,6 +24,7 @@ class Page(models.Model): content = models.TextField() toc = models.JSONField() slug = models.CharField(max_length=128, unique=True, db_index=True, default=None, null=True) + file_path = models.CharField(max_length=255) tags = models.ManyToManyField(Tag) diff --git a/yamdl_playground/core/utils.py b/yamdl_playground/core/utils.py index dd83c67..d0701e5 100644 --- a/yamdl_playground/core/utils.py +++ b/yamdl_playground/core/utils.py @@ -5,6 +5,8 @@ class CustomYamdlLoader(ModelLoader): if file_path.suffix not in self.EXT_YAML: data["slug"] = file_path.stem + data["file_path"] = file_path + super().load_fixture(model_class, data, file_path)