diff options
-rwxr-xr-x | forum/models/__init__.py | 3 | ||||
-rwxr-xr-x | forum/skins/default/templates/index.html | 4 | ||||
-rwxr-xr-x | forum/skins/default/templates/question_list.html | 4 | ||||
-rwxr-xr-x | forum/skins/default/templates/user_tabs.html | 14 | ||||
-rwxr-xr-x | forum/skins/default/templates/users.html | 4 |
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 }}">●</span> {{ 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> |