diff gpp/forums/views/main.py @ 469:3b30286adba5

Smarter search index updating for forums. This work is for #227.
author Brian Neal <bgneal@gmail.com>
date Wed, 17 Aug 2011 01:02:08 +0000
parents 2ff5f4c1476d
children 82b97697312e
line wrap: on
line diff
--- a/gpp/forums/views/main.py	Sun Aug 07 03:38:42 2011 +0000
+++ b/gpp/forums/views/main.py	Wed Aug 17 01:02:08 2011 +0000
@@ -36,6 +36,8 @@
 
 from forums.attachments import AttachmentProcessor
 import forums.permissions as perms
+from forums.signals import (notify_new_topic, notify_updated_topic,
+        notify_new_post, notify_updated_post)
 
 #######################################################################
 
@@ -440,10 +442,12 @@
             post = form.save(commit=False)
             post.touch()
             post.save()
+            notify_updated_post(post)
 
             # if we are editing a first post, save the parent topic as well
             if topic_name:
                 post.topic.save()
+                notify_updated_topic(post.topic)
 
             # Save any attachments
             form.attach_proc.save_attachments(post)
@@ -590,6 +594,7 @@
                 post.user = request.user
                 post.user_ip = request.META.get("REMOTE_ADDR", "")
                 post.save()
+                notify_new_post(post)
 
                 # Save any attachments
                 form.attach_proc.save_attachments(post)
@@ -1102,6 +1107,7 @@
     if len(posts) > 0:
         new_topic = Topic(forum=new_forum, name=new_name, user=posts[0].user)
         new_topic.save()
+        notify_new_topic(new_topic)
         for post in posts:
             post.topic = new_topic
             post.save()