diff options
author | luxagraf <sng@luxagraf.net> | 2020-08-05 09:26:18 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-08-05 09:26:18 -0400 |
commit | 1c8542bba4404932c621af0d9d93813218340af1 (patch) | |
tree | 64c58d4aec33103d6778fb032524839b3d8b378c /app/posts/models.py | |
parent | 55409474092d594f3c483e0869b71f962c706322 (diff) |
Changed post save function to handle not having epilogues and
prologues
Diffstat (limited to 'app/posts/models.py')
-rw-r--r-- | app/posts/models.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/posts/models.py b/app/posts/models.py index 7e05ebb..b92518c 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -64,6 +64,7 @@ class Post(models.Model): (1, 'review'), (2, 'essay'), (3, 'src'), + (4, 'jrnl'), ) post_type = models.IntegerField(choices=POST_TYPE, default=0) template_name = models.IntegerField(choices=TEMPLATES, default=0) @@ -143,8 +144,10 @@ class Post(models.Model): md = render_images(self.body_markdown) prods = render_products(md) self.body_html = markdown_to_html(prods) - self.epilogue_html = markdown_to_html(self.epilogue_markdown) - self.prologue_html = markdown_to_html(self.prologue_markdown) + if self.epilogue_html: + self.epilogue_html = markdown_to_html(self.epilogue_markdown) + if self.prologue_html: + self.prologue_html = markdown_to_html(self.prologue_markdown) self.has_video = parse_video(self.body_html) if self.point: try: @@ -212,6 +215,7 @@ class PostSitemap(Sitemap): def lastmod(self, obj): return obj.pub_date + """ for p in src: s, created = Post.objects.get_or_create( |