]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/node.py
node edits not updating last_edited_by
[osqa.git] / forum / models / node.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