summaryrefslogtreecommitdiff
path: root/app/posts/models.py
diff options
context:
space:
mode:
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