from django.contrib.auth.models import User as DjangoUser, AnonymousUser as DjangoAnonymousUser
from django.db.models import Q
+from django.utils.encoding import smart_unicode
+
from forum.settings import TRUNCATE_LONG_USERNAMES, TRUNCATE_USERNAMES_LONGER_THAN
import string
vote_down_count = DenormalizedField("actions", canceled=False, action_type="votedown")
def __unicode__(self):
- return self.username
+ return smart_unicode(self.username)
@property
def prop(self):
@property
def decorated_name(self):
- username = self.username
+ username = smart_unicode(self.username)
if len(username) > TRUNCATE_USERNAMES_LONGER_THAN and TRUNCATE_LONG_USERNAMES:
username = '%s...' % username[:TRUNCATE_USERNAMES_LONGER_THAN-3]
@models.permalink
def get_profile_url(self):
- return ('user_profile', (), {'id': self.id, 'slug': slugify(self.username)})
+ return ('user_profile', (), {'id': self.id, 'slug': slugify(smart_unicode(self.username))})
def get_absolute_url(self):
return self.get_profile_url()
from forum.modules import ui, get_modules_script
from django.utils.translation import ugettext as _
+from django.utils.encoding import smart_unicode
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
ui.Link(
visibility=ui.Visibility.AUTHENTICATED,
- text=lambda u, c: u.username,
+ text=lambda u, c: smart_unicode(u.username),
url=lambda u, c: u.get_profile_url(),
post_code=lambda u, c: get_score_badge(u),
weight=100, name='ACCOUNT'),
from django.utils.translation import ugettext as _\r
from django.utils.http import urlquote_plus\r
from django.utils.html import strip_tags\r
+from django.utils.encoding import smart_unicode\r
from django.utils import simplejson\r
from django.core.urlresolvers import reverse, NoReverseMatch\r
from forum.forms import *\r
decorated = decorate.params.withfn(params)(fn)\r
\r
def result(context, request, user):\r
- rev_page_title = user.username + " - " + tab_description\r
+ rev_page_title = smart_unicode(user.username) + " - " + tab_description\r
\r
context.update({\r
"tab": "users",\r