X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/5c27752e396ef1b6e794a489b577b0f7be3126b6..886fb5136dfb9ff258b8948c981a68bbf3550208:/forum_modules/pgfulltext/handlers.py diff --git a/forum_modules/pgfulltext/handlers.py b/forum_modules/pgfulltext/handlers.py index 04d3a67..780bfa9 100644 --- a/forum_modules/pgfulltext/handlers.py +++ b/forum_modules/pgfulltext/handlers.py @@ -1,6 +1,8 @@ import re +from django.db import connection, transaction from django.db.models import Q from forum.models.question import Question, QuestionManager +from forum.models.node import Node from forum.modules import decorate word_re = re.compile(r'\w+', re.UNICODE) @@ -26,5 +28,11 @@ def question_search(self, keywords): ) +@decorate(Node.delete) +def delete(origin, self, *args, **kwargs): + cursor = connection.cursor() + cursor.execute("DELETE FROM forum_rootnode_doc WHERE node_id = %s" % (self.id)) + transaction.commit_unless_managed() + return origin(self, *args, **kwargs)