1
Fork 0

Store file path

This commit is contained in:
Jake Howard 2024-10-11 15:35:54 +01:00
parent 351f5593d2
commit d38d2ecb1c
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 4 additions and 0 deletions

View file

@ -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)

View file

@ -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)