From 26dc6264fd04855c752b03517707bd94f76284ee Mon Sep 17 00:00:00 2001 From: hernani Date: Mon, 19 Apr 2010 03:01:56 +0000 Subject: [PATCH 1/1] node edits not updating last_edited_by git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@53 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/models/node.py | 10 +++++++--- forum/views/readers.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/forum/models/node.py b/forum/models/node.py index 13749cd..9e734d2 100644 --- a/forum/models/node.py +++ b/forum/models/node.py @@ -77,6 +77,7 @@ class NodeMetaClass(models.Model.__metaclass__): node_create = django.dispatch.Signal(providing_args=['instance']) +node_edit = django.dispatch.Signal(providing_args=['instance']) class Node(BaseModel, NodeContent, DeletableContent): __metaclass__ = NodeMetaClass @@ -136,14 +137,17 @@ class Node(BaseModel, NodeContent, DeletableContent): self.body = revision.body old_revision = self.active_revision - self.active_revision = revision - self.save() if not old_revision: + signal = node_create + else: self.last_edited_at = datetime.datetime.now() self.last_edited_by = user - node_create.send(sender=self.__class__, instance=self) + signal = node_edit + + self.save() + signal.send(sender=self.__class__, instance=self) def get_tag_list_if_changed(self): dirty = self.get_dirty_fields() diff --git a/forum/views/readers.py b/forum/views/readers.py index ebcebe2..879dbcf 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -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 -- 2.39.5