# HG changeset patch # User neko259 # Date 2016-05-09 15:56:40 # Node ID 334c97d60c907dcc09401c0a0ddeb27748043008 # Parent 9a0b522184e9ae202775f6a520b9a2825f97af27 Fixed merge issue 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 @@ -379,32 +379,3 @@ class Post(models.Model, Viewable): def set_hidden(self, hidden): self.hidden = hidden - - -# SIGNALS (Maybe move to other module?) -@receiver(post_save, sender=Post) -def connect_replies(instance, **kwargs): - for reply_number in re.finditer(REGEX_REPLY, instance.get_raw_text()): - post_id = reply_number.group(1) - - 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']) - except ObjectDoesNotExist: - pass - - -@receiver(post_save, sender=Post) -def connect_notifications(instance, **kwargs): - for reply_number in re.finditer(REGEX_NOTIFICATION, instance.get_raw_text()): - user_name = reply_number.group(1).lower() - Notification.objects.get_or_create(name=user_name, post=instance) - - -@receiver(pre_save, sender=Post) -def preparse_text(instance, **kwargs): - instance._text_rendered = get_parser().parse(instance.get_raw_text()) diff --git a/boards/signals.py b/boards/signals.py --- a/boards/signals.py +++ b/boards/signals.py @@ -19,12 +19,13 @@ def connect_replies(instance, **kwargs): try: referenced_post = Post.objects.get(id=post_id) - if not referenced_post.referenced_posts.filter(id=instance.id).exists(): + 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 Post.ObjectDoesNotExist: + except Post.DoesNotExist: pass