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)