summaryrefslogtreecommitdiff
path: root/app/posts/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-08-25 19:15:51 -0400
committerluxagraf <sng@luxagraf.net>2020-08-25 19:15:51 -0400
commit916b3b7a6cf8b59b1c377bbc6a9d3272a8045588 (patch)
tree5a5f9bc35f3ef6e2824074f34dd18a5a0c0dbba6 /app/posts/models.py
parent2cd762329ee7c9dd7b2e8ab02824b32abbc44482 (diff)
fixed some bugs in post save
Diffstat (limited to 'app/posts/models.py')
-rw-r--r--app/posts/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/posts/models.py b/app/posts/models.py
index 196c941..4a43457 100644
--- a/app/posts/models.py
+++ b/app/posts/models.py
@@ -30,7 +30,7 @@ from books.models import Book
from fieldnotes.models import FieldNote
from taxonomy.models import TaggedItems, Category
from jrnl.models import Entry
-from utils.util import render_images, render_products, parse_video, markdown_to_html
+from utils.util import render_images, render_products, parse_video, markdown_to_html, extract_main_image
class PostType(models.IntegerChoices):
@@ -179,7 +179,7 @@ class Post(models.Model):
self.featured_image.sizes.add(s)
self.featured_image.sizes.add(ss)
self.featured_image.save()
- if old.title != self.title or old.slug != self.slug:
+ if old and old.title != self.title or old and old.slug != self.slug:
related, c = RelatedPost.objects.get_or_create(model_name=self.get_content_type(), entry_id = self.id, pub_date=self.pub_date)
related.title = self.title
related.slug = self.slug