From: hernani Date: Tue, 25 May 2010 11:16:38 +0000 (+0000) Subject: Both auto-complete features, tag and questions were not filtering deleted objects. X-Git-Tag: live~805 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/d806c871a8829172d645cea7d0cf5896cf5a37d4?ds=sidebyside;hp=556b606eee95245369a29dcd870b89e0d44686d8 Both auto-complete features, tag and questions were not filtering deleted objects. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@326 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/views/commands.py b/forum/views/commands.py index 92e9857..40d61ec 100644 --- a/forum/views/commands.py +++ b/forum/views/commands.py @@ -461,7 +461,7 @@ def matching_tags(request): if len(request.GET['q']) == 0: raise CommandException(_("Invalid request")) - possible_tags = Tag.objects.filter(name__istartswith = request.GET['q']) + possible_tags = Tag.active.filter(name__istartswith = request.GET['q']) tag_output = '' for tag in possible_tags: tag_output += (tag.name + "|" + tag.name + "." + tag.used_count.__str__() + "\n") @@ -472,7 +472,7 @@ def related_questions(request): if request.POST and request.POST.get('title', None): return HttpResponse(simplejson.dumps( [dict(title=q.title, url=q.get_absolute_url(), score=q.score, summary=q.summary) - for q in Question.objects.search(request.POST['title'])[0:10]]), mimetype="application/json") + for q in Question.objects.search(request.POST['title']).filter_state(deleted=False)[0:10]]), mimetype="application/json") else: raise Http404()