##// END OF EJS Templates
Fixed merge issue
neko259 -
r1544:334c97d6 decentral
parent child Browse files
Show More
@@ -379,32 +379,3 b' class Post(models.Model, Viewable):'
379 379
380 380 def set_hidden(self, hidden):
381 381 self.hidden = hidden
382
383
384 # SIGNALS (Maybe move to other module?)
385 @receiver(post_save, sender=Post)
386 def connect_replies(instance, **kwargs):
387 for reply_number in re.finditer(REGEX_REPLY, instance.get_raw_text()):
388 post_id = reply_number.group(1)
389
390 try:
391 referenced_post = Post.objects.get(id=post_id)
392
393 referenced_post.referenced_posts.add(instance)
394 referenced_post.last_edit_time = instance.pub_time
395 referenced_post.build_refmap()
396 referenced_post.save(update_fields=['refmap', 'last_edit_time'])
397 except ObjectDoesNotExist:
398 pass
399
400
401 @receiver(post_save, sender=Post)
402 def connect_notifications(instance, **kwargs):
403 for reply_number in re.finditer(REGEX_NOTIFICATION, instance.get_raw_text()):
404 user_name = reply_number.group(1).lower()
405 Notification.objects.get_or_create(name=user_name, post=instance)
406
407
408 @receiver(pre_save, sender=Post)
409 def preparse_text(instance, **kwargs):
410 instance._text_rendered = get_parser().parse(instance.get_raw_text())
@@ -19,12 +19,13 b' def connect_replies(instance, **kwargs):'
19 19 try:
20 20 referenced_post = Post.objects.get(id=post_id)
21 21
22 if not referenced_post.referenced_posts.filter(id=instance.id).exists():
22 if not referenced_post.referenced_posts.filter(
23 id=instance.id).exists():
23 24 referenced_post.referenced_posts.add(instance)
24 25 referenced_post.last_edit_time = instance.pub_time
25 26 referenced_post.build_refmap()
26 27 referenced_post.save(update_fields=['refmap', 'last_edit_time'])
27 except Post.ObjectDoesNotExist:
28 except Post.DoesNotExist:
28 29 pass
29 30
30 31
General Comments 0
You need to be logged in to leave comments. Login now