From 9476f5750fe4a456c6624e965fbd3a922a85919d Mon Sep 17 00:00:00 2001 From: jordan Date: Mon, 11 Apr 2011 20:10:22 +0000 Subject: [PATCH] Some tags Unicode improvements. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@973 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/models/tag.py | 3 ++- forum/views/readers.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/forum/models/tag.py b/forum/models/tag.py index 5b6bef3..5592c4b 100644 --- a/forum/models/tag.py +++ b/forum/models/tag.py @@ -2,6 +2,7 @@ import datetime from base import * from django.utils.translation import ugettext as _ +from django.utils.encoding import smart_unicode from forum import modules @@ -26,7 +27,7 @@ class Tag(BaseModel): app_label = 'forum' def __unicode__(self): - return self.name + return smart_unicode(self.name) def add_to_usage_count(self, value): if self.used_count + value < 0: diff --git a/forum/views/readers.py b/forum/views/readers.py index 0ef481e..2878424 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -10,6 +10,7 @@ from django.template import RequestContext from django import template from django.utils.html import * from django.utils import simplejson +from django.utils.encoding import smart_unicode from django.db.models import Q, Count from django.utils.translation import ugettext as _ from django.template.defaultfilters import slugify @@ -107,7 +108,7 @@ def tag(request, tag): raise Http404 # Getting the questions QuerySet - questions = Question.objects.filter(tags=tag) + questions = Question.objects.filter(tags__name=smart_unicode(tag.name)) if request.method == "GET": user = request.GET.get('user', None) -- 2.39.5