X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/243cb773ed9d1c4c7b3fa1c4ba7fb79ef6dc5ec0..f4730c2cb758de12b6487e3a036a9a9c70bb5d4f:/forum/views/commands.py diff --git a/forum/views/commands.py b/forum/views/commands.py index ad6d773..7b44322 100644 --- a/forum/views/commands.py +++ b/forum/views/commands.py @@ -490,13 +490,25 @@ def matching_tags(request): if len(request.GET['q']) == 0: raise CommandException(_("Invalid request")) - possible_tags = Tag.active.filter(name__istartswith = request.GET['q']) + possible_tags = Tag.active.filter(name__icontains = request.GET['q']) tag_output = '' for tag in possible_tags: - tag_output += (tag.name + "|" + tag.name + "." + tag.used_count.__str__() + "\n") + tag_output += "%s|%s|%s\n" % (tag.id, tag.name, tag.used_count) return HttpResponse(tag_output, mimetype="text/plain") +def matching_users(request): + if len(request.GET['q']) == 0: + raise CommandException(_("Invalid request")) + + possible_users = User.objects.filter(username__icontains = request.GET['q']) + output = '' + + for user in possible_users: + output += ("%s|%s|%s\n" % (user.id, user.decorated_name, user.reputation)) + + return HttpResponse(output, mimetype="text/plain") + def related_questions(request): if request.POST and request.POST.get('title', None): can_rank, questions = Question.objects.search(request.POST['title'])