summaryrefslogtreecommitdiff
path: root/app/jrnl/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/jrnl/models.py')
-rw-r--r--app/jrnl/models.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py
index b9ebaf8..69d1178 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -199,6 +199,12 @@ class Entry(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:
+ 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
+ related.save()
+
super(Entry, self).save(*args, **kwargs)
@@ -280,12 +286,6 @@ def post_save_events(sender, update_fields, created, instance, **kwargs):
"""
if created:
related, c = RelatedPost.objects.get_or_create(model_name=instance.get_content_type(), entry_id = instance.id, pub_date=instance.pub_date, title=instance.title, slug=instance.slug)
- if update_fields:
- if 'title' in update_fields or 'slug' in update_fields:
- related, c = RelatedPost.objects.get_or_create(model_name=instance.get_content_type(), entry_id = instance.id, pub_date=instance.pub_date)
- related.title = instance.title
- related.slug = instance.slug
- related.save()
# from django_comments.signals import comment_will_be_posted
# from django_comments import akismet