summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-04-12 15:41:46 -0400
committerluxagraf <sng@luxagraf.net>2020-04-12 15:41:46 -0400
commit8024ee33de61150b8dad3c0b15952bf54ff45e1a (patch)
treec21f4324375126016798111f9f6d4e682607b631
parent426dd7545dbe74c405aed922169ba1d2e9df0892 (diff)
fixed jrnl post save to update related objects
-rw-r--r--app/jrnl/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py
index f3734da..a1ab9a7 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -278,9 +278,9 @@ def post_save_events(sender, update_fields, created, instance, **kwargs):
"""
Creates a generic related entry when a new post is added
"""
- if created:
+ if created or '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.pubdate)
- if c:
+ if not c:
related.title = instance.title
related.slug = instance.slug
related.save()