X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/410bfa05ee36ed1d99356c443a5f3f6aa3ee9578..80e81e8ba3e132d6b51a0bb4c794d8f2c1f600d9:/forum/models/question.py diff --git a/forum/models/question.py b/forum/models/question.py index 5484016..9e8dcf6 100644 --- a/forum/models/question.py +++ b/forum/models/question.py @@ -1,9 +1,15 @@ from base import * from tag import Tag from django.utils.translation import ugettext as _ +from forum.modules.decorators import decoratable question_view = django.dispatch.Signal(providing_args=['instance', 'user']) +class QuestionManager(NodeManager): + @decoratable.method + def search(self, keywords): + return self.filter(models.Q(title__icontains=keywords) | models.Q(body__icontains=keywords)) + class Question(Node): class Meta(Node.Meta): proxy = True @@ -12,6 +18,7 @@ class Question(Node): favorite_count = DenormalizedField("actions", action_type="favorite", canceled=False) friendly_name = _("question") + objects = QuestionManager() @property def closed(self):