##// END OF EJS Templates
Connect replies only if this is a generic save, not some specific fields update
neko259 -
r1837:772d4b19 default
parent child Browse files
Show More
@@ -23,6 +23,7 b' THUMB_SIZES = ((200, 150),)'
23
23
24 @receiver(post_save, sender=Post)
24 @receiver(post_save, sender=Post)
25 def connect_replies(instance, **kwargs):
25 def connect_replies(instance, **kwargs):
26 if not kwargs['update_fields']:
26 for reply_number in re.finditer(REGEX_REPLY, instance.get_raw_text()):
27 for reply_number in re.finditer(REGEX_REPLY, instance.get_raw_text()):
27 post_id = reply_number.group(1)
28 post_id = reply_number.group(1)
28
29
@@ -42,6 +43,7 b' def connect_replies(instance, **kwargs):'
42 @receiver(post_save, sender=Post)
43 @receiver(post_save, sender=Post)
43 @receiver(post_import_deps, sender=Post)
44 @receiver(post_import_deps, sender=Post)
44 def connect_global_replies(instance, **kwargs):
45 def connect_global_replies(instance, **kwargs):
46 if not kwargs['update_fields']:
45 for reply_number in re.finditer(REGEX_GLOBAL_REPLY, instance.get_raw_text()):
47 for reply_number in re.finditer(REGEX_GLOBAL_REPLY, instance.get_raw_text()):
46 key_type = reply_number.group(1)
48 key_type = reply_number.group(1)
47 key = reply_number.group(2)
49 key = reply_number.group(2)
@@ -61,6 +63,7 b' def connect_global_replies(instance, **k'
61
63
62 @receiver(post_save, sender=Post)
64 @receiver(post_save, sender=Post)
63 def connect_notifications(instance, **kwargs):
65 def connect_notifications(instance, **kwargs):
66 if not kwargs['update_fields']:
64 for reply_number in re.finditer(REGEX_NOTIFICATION, instance.get_raw_text()):
67 for reply_number in re.finditer(REGEX_NOTIFICATION, instance.get_raw_text()):
65 user_name = reply_number.group(1).lower()
68 user_name = reply_number.group(1).lower()
66 Notification.objects.get_or_create(name=user_name, post=instance)
69 Notification.objects.get_or_create(name=user_name, post=instance)
General Comments 0
You need to be logged in to leave comments. Login now