]> git.openstreetmap.org Git - osqa.git/commitdiff
node edits not updating last_edited_by
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 19 Apr 2010 03:01:56 +0000 (03:01 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 19 Apr 2010 03:01:56 +0000 (03:01 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@53 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/models/node.py
forum/views/readers.py

index 13749cd9872a5af40019e7154b96f7df12a9bff5..9e734d26df9e641a14c0d76bea8591bacfbb79a1 100644 (file)
@@ -77,6 +77,7 @@ class NodeMetaClass(models.Model.__metaclass__):
 \r
 \r
 node_create = django.dispatch.Signal(providing_args=['instance'])\r
+node_edit = django.dispatch.Signal(providing_args=['instance'])\r
 \r
 class Node(BaseModel, NodeContent, DeletableContent):\r
     __metaclass__ = NodeMetaClass\r
@@ -136,14 +137,17 @@ class Node(BaseModel, NodeContent, DeletableContent):
         self.body = revision.body\r
 \r
         old_revision = self.active_revision\r
-\r
         self.active_revision = revision\r
-        self.save()\r
 \r
         if not old_revision:\r
+            signal = node_create\r
+        else:\r
             self.last_edited_at = datetime.datetime.now()\r
             self.last_edited_by = user\r
-            node_create.send(sender=self.__class__, instance=self)\r
+            signal = node_edit\r
+\r
+        self.save()\r
+        signal.send(sender=self.__class__, instance=self)\r
 \r
     def get_tag_list_if_changed(self):\r
         dirty = self.get_dirty_fields()\r
index ebcebe23eb8e5ecb0e7b6cc5f6bd3f560720b727..879dbcf8083ca51207f04f09f14e98c9d3b3aff9 100644 (file)
@@ -121,7 +121,7 @@ def search(request):
 @decorators.render('questions.html')
 def question_search(request, keywords):
     def question_search(keywords):
-        return Question.objects.filter(Q(title__icontains=keywords) | Q(html__icontains=keywords))
+        return Question.objects.filter(Q(title__icontains=keywords) | Q(body__icontains=keywords))
 
     from forum.modules import get_handler