From fd5174ac564e77cabc5e1a5919f2d29f426fb261 Mon Sep 17 00:00:00 2001
From: jordan
Date: Tue, 3 May 2011 18:30:47 +0000
Subject: [PATCH] Fixes OSQA-663, the user.username property should pass
through the smart_unicode function to avoid trouble. Creating a separate
get_user_subscriptions_url method.
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1019 0cfe37f9-358a-4d5e-be75-b63607b5c754
---
forum/models/user.py | 6 +++++-
forum/skins/default/templates/subscription_status.html | 3 +--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/forum/models/user.py b/forum/models/user.py
index b5bef17..ae8f938 100644
--- a/forum/models/user.py
+++ b/forum/models/user.py
@@ -205,7 +205,11 @@ class User(BaseModel, DjangoUser):
@models.permalink
def get_asked_url(self):
- return ('user_questions', (), {'mode': _('asked-by'), 'user': self.id, 'slug': slugify(self.username)})
+ return ('user_questions', (), {'mode': _('asked-by'), 'user': self.id, 'slug': slugify(smart_unicode(self.username))})
+
+ @models.permalink
+ def get_user_subscriptions_url(self):
+ return ('user_subscriptions', (), { 'id': self.id, 'slug': slugify(smart_unicode(self.username))})
@models.permalink
def get_answered_url(self):
diff --git a/forum/skins/default/templates/subscription_status.html b/forum/skins/default/templates/subscription_status.html
index d97dccd..49ec02f 100644
--- a/forum/skins/default/templates/subscription_status.html
+++ b/forum/skins/default/templates/subscription_status.html
@@ -22,8 +22,7 @@
{% endif %}
- {% url user_subscriptions id=request.user.id,slug=request.user.username|slugify as subscriptions_url %}
- {% blocktrans %}
+ {% blocktrans with request.user.get_user_subscriptions_url as subscriptions_url %}
(you can adjust your notification settings on your profile)
{% endblocktrans %}
--
2.39.5