Store file path
This commit is contained in:
parent
351f5593d2
commit
d38d2ecb1c
2 changed files with 4 additions and 0 deletions
|
@ -7,6 +7,7 @@ class Tag(models.Model):
|
||||||
__yamdl__ = True
|
__yamdl__ = True
|
||||||
|
|
||||||
slug = models.SlugField(max_length=128, primary_key=True)
|
slug = models.SlugField(max_length=128, primary_key=True)
|
||||||
|
file_path = models.CharField(max_length=255)
|
||||||
|
|
||||||
content = models.TextField()
|
content = models.TextField()
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ class Page(models.Model):
|
||||||
content = models.TextField()
|
content = models.TextField()
|
||||||
toc = models.JSONField()
|
toc = models.JSONField()
|
||||||
slug = models.CharField(max_length=128, unique=True, db_index=True, default=None, null=True)
|
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)
|
tags = models.ManyToManyField(Tag)
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ class CustomYamdlLoader(ModelLoader):
|
||||||
if file_path.suffix not in self.EXT_YAML:
|
if file_path.suffix not in self.EXT_YAML:
|
||||||
data["slug"] = file_path.stem
|
data["slug"] = file_path.stem
|
||||||
|
|
||||||
|
data["file_path"] = file_path
|
||||||
|
|
||||||
super().load_fixture(model_class, data, file_path)
|
super().load_fixture(model_class, data, file_path)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue