summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-03-31 12:40:25 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-03-31 12:40:25 -0400
commit60b04163c9096a7b24cbe52e1095c47ba04271f8 (patch)
treea7fe46d3a8d6d6947a74503bfcbd1b26090f197c
parent9382f29e650f8d239f5a40fca3fedc89ebd834b3 (diff)
downloadaskbot-60b04163c9096a7b24cbe52e1095c47ba04271f8.tar.gz
askbot-60b04163c9096a7b24cbe52e1095c47ba04271f8.tar.bz2
askbot-60b04163c9096a7b24cbe52e1095c47ba04271f8.zip
fixed translations of user profile URLs
-rwxr-xr-xforum/models/__init__.py3
-rwxr-xr-xforum/skins/default/templates/index.html4
-rwxr-xr-xforum/skins/default/templates/question_list.html4
-rwxr-xr-xforum/skins/default/templates/user_tabs.html14
-rwxr-xr-xforum/skins/default/templates/users.html4
5 files changed, 15 insertions, 14 deletions
diff --git a/forum/models/__init__.py b/forum/models/__init__.py
index f4850025..d144982d 100755
--- a/forum/models/__init__.py
+++ b/forum/models/__init__.py
@@ -4,6 +4,7 @@ from tag import Tag, MarkedTag
from meta import Vote, Comment, FlaggedItem
from user import Activity, ValidationHash, EmailFeedSetting, AuthKeyUserAssociation
from repute import Badge, Award, Repute
+from django.core.urlresolvers import reverse
import re
from base import *
@@ -98,7 +99,7 @@ def delete_messages(self):
def get_profile_url(self):
"""Returns the URL for this User's profile."""
- return "/users/%d/%s" % (self.id, slugify(self.username))
+ return reverse('user_profile', kwargs={'id':self.id, 'slug':slugify(self.username)})
def get_profile_link(self):
profile_link = u'<a href="%s">%s</a>' % (self.get_profile_url(),self.username)
diff --git a/forum/skins/default/templates/index.html b/forum/skins/default/templates/index.html
index 61a5e6b3..c2f36c9c 100755
--- a/forum/skins/default/templates/index.html
+++ b/forum/skins/default/templates/index.html
@@ -72,7 +72,7 @@
<li>
<a href="{% url badges %}{{award.badge_id}}/{{award.badge_name}}" title="{{ award.badge_description }}" class="medal">
<span class="badge{{ award.badge_type }}">&#9679;</span>&nbsp;{{ award.badge_name }}</a>
- <a href="/users/{{ award.user_id }}/{{ award.user_name|slugify }}/">{{ award.user_name }}</a>
+ <a href="{% url user_profile award.user_id award.user_name|slugify %}">{{ award.user_name }}</a>
</li>
{% endfor %}
{% endcache %}
@@ -92,4 +92,4 @@
<span class="evenMore">{% trans "Still looking for more? See" %} <a href="{% url questions %}">{% trans "complete list of questions" %}</a> {% trans "or" %} <a href="{% url tags %}">{% trans "popular tags" %}</a>{% trans "." %} {% trans "Please help us answer" %} <a href="{% url questions %}unanswered">{% trans "list of unanswered questions" %}</a>{% trans "." %}</span>
</div> -->
{% endblock %}
-<!-- index.html --> \ No newline at end of file
+<!-- index.html -->
diff --git a/forum/skins/default/templates/question_list.html b/forum/skins/default/templates/question_list.html
index cf69d133..d822a267 100755
--- a/forum/skins/default/templates/question_list.html
+++ b/forum/skins/default/templates/question_list.html
@@ -27,7 +27,7 @@
<div class="userinfo">
<span class="relativetime" title="{{question.last_activity_at}}">{% diff_date question.last_activity_at %}</span>
{% if question.last_activity_by %}
- <a href="/users/{{ question.last_activity_by.id }}/{{ question.last_activity_by.username|slugify }}/">{{ question.last_activity_by }}</a> {% get_score_badge question.last_activity_by %}
+ <a href="{% url user_profile question.last_activity_by.id question.last_activity_by.username|slugify %}">{{ question.last_activity_by }}</a> {% get_score_badge question.last_activity_by %}
{% endif %}
</div>
@@ -39,4 +39,4 @@
</div>
{% endcache %}
{% endfor %}
-</div> \ No newline at end of file
+</div>
diff --git a/forum/skins/default/templates/user_tabs.html b/forum/skins/default/templates/user_tabs.html
index 136a1eaa..d0d52930 100755
--- a/forum/skins/default/templates/user_tabs.html
+++ b/forum/skins/default/templates/user_tabs.html
@@ -4,28 +4,28 @@
<div class="tabBar">
<div class="tabsA">
<a id="stats" {% ifequal tab_name "stats" %}class="on"{% endifequal %}
- title="{% trans "User profile" %}" href="/users/{{ view_user.id }}/{{ view_user.username|slugify }}/?sort=stats">{% trans "overview" %}</a>
+ title="{% trans "User profile" %}" href="{% url user_profile view_user.id view_user.username|slugify %}?sort=stats">{% trans "overview" %}</a>
<a id="recent" {% ifequal tab_name "recent" %}class="on"{% endifequal %}
- title="{% trans "recent activity" %}" href="/users/{{ view_user.id }}/{{ view_user.username|slugify }}?sort=recent">{% trans "recent activity" %}</a>
+ title="{% trans "recent activity" %}" href="{% url user_profile view_user.id view_user.username|slugify %}?sort=recent">{% trans "recent activity" %}</a>
{% if request.user|is_user_self:view_user %}
<a id="responses" {% ifequal tab_name "responses" %}class="on"{% endifequal %}
title="{% trans "comments and answers to others questions" %}"
- href="/users/{{ view_user.id }}/{{ view_user.username|slugify }}?sort=responses">{% trans "responses" %}</a>
+ href="{% url user_profile view_user.id view_user.username|slugify %}?sort=responses">{% trans "responses" %}</a>
{% endif %}
<a id="reputation" {% ifequal tab_name "reputation" %}class="on"{% endifequal %}
title="{% trans "graph of user reputation" %}"
- href="/users/{{ view_user.id }}/{{ view_user.username|slugify }}?sort=reputation">{% trans "reputation history" %}</a>
+ href="{% url user_profile view_user.id view_user.username|slugify %}?sort=reputation">{% trans "reputation history" %}</a>
{% if request.user|can_view_user_votes:view_user %}
<a id="votes" {% ifequal tab_name "votes" %}class="on"{% endifequal %}
- title="{% trans "user vote record" %}" href="/users/{{ view_user.id }}/{{ view_user.username|slugify }}?sort=votes">{% trans "casted votes" %}</a>
+ title="{% trans "user vote record" %}" href="{% url user_profile view_user.id view_user.username|slugify %}?sort=votes">{% trans "casted votes" %}</a>
{% endif %}
<a id="favorites" {% ifequal tab_name "favorites" %}class="on"{% endifequal %}
title="{% trans "questions that user selected as his/her favorite" %}"
- href="/users/{{ view_user.id }}/{{ view_user.username|slugify }}?sort=favorites">{% trans "favorites" %}</a>
+ href="{% url user_profile view_user.id view_user.username|slugify %}?sort=favorites">{% trans "favorites" %}</a>
{% if request.user|can_view_user_preferences:view_user %}
<a id="email_subscriptions" {% ifequal tab_name "email_subscriptions" %}class="on"{% endifequal %}
title="{% trans "email subscription settings" %}"
- href="/users/{{ view_user.id }}/{{ view_user.username|slugify }}?sort=email_subscriptions">{% trans "email subscriptions" %}</a>
+ href="{% url user_profile view_user.id view_user.username|slugify %}?sort=email_subscriptions">{% trans "email subscriptions" %}</a>
{% endif %}
</div>
</div>
diff --git a/forum/skins/default/templates/users.html b/forum/skins/default/templates/users.html
index f24b60a1..4f92daa4 100755
--- a/forum/skins/default/templates/users.html
+++ b/forum/skins/default/templates/users.html
@@ -47,8 +47,8 @@
<div class="user">
<ul>
- <li class="thumb"><a href="/users/{{ user.id }}/{{ user.username|slugify }}/">{% gravatar user 32 %}</a></li>
- <li><a href="/users/{{ user.id }}/{{ user.username|slugify }}/">{{user.username}}</a></li>
+ <li class="thumb"><a href="{% url user_profile user.id user.username|slugify %}">{% gravatar user 32 %}</a></li>
+ <li><a href="{% url user_profile user.id user.username|slugify %}">{{user.username}}</a></li>
<li>{% get_score_badge user %}</li>
</ul>
</div>