diff --git a/boards/models/post/__init__.py b/boards/models/post/__init__.py --- a/boards/models/post/__init__.py +++ b/boards/models/post/__init__.py @@ -347,10 +347,12 @@ def connect_replies(instance, **kwargs): try: referenced_post = Post.objects.get(id=post_id) - referenced_post.referenced_posts.add(instance) - referenced_post.last_edit_time = instance.pub_time - referenced_post.build_refmap() - referenced_post.save(update_fields=['refmap', 'last_edit_time']) + # Connect only to posts that are not connected to already + if not referenced_post.referenced_posts.filter(id=instance.id).exists(): + referenced_post.referenced_posts.add(instance) + referenced_post.last_edit_time = instance.pub_time + referenced_post.build_refmap() + referenced_post.save(update_fields=['refmap', 'last_edit_time']) except ObjectDoesNotExist: pass