diff options
Diffstat (limited to 'forum')
-rw-r--r-- | forum/views.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/forum/views.py b/forum/views.py index 6ef7bd6d..a118cc57 100644 --- a/forum/views.py +++ b/forum/views.py @@ -301,7 +301,7 @@ def ask(request): ip_addr = request.META['REMOTE_ADDR'], ) question.save() - return HttpResponseRedirect('%s%s%s' % ( _('/account/'),_('signin/'),('newquestion/'))) + return HttpResponseRedirect('/%s%s%s' % ( _('account/'),_('signin/'),_('newquestion/'))) else: form = AskForm() @@ -692,7 +692,8 @@ def answer(request, id): ip_addr = request.META['REMOTE_ADDR'], ) anon.save() - return HttpResponseRedirect('/account/signin/newanswer') + return HttpResponseRedirect('/%s%s%s' % ( _('account/'), + _('signin/'),_('newquestion/'))) return HttpResponseRedirect(question.get_absolute_url()) @@ -733,7 +734,7 @@ def tags(request): 'has_next': tags.has_next(), 'previous': tags.previous_page_number(), 'next': tags.next_page_number(), - 'base_url' : '/tags/?sort=%s&' % sortby + 'base_url' : '/%s?sort=%s&' % (_('tags/'), sortby) } }, context_instance=RequestContext(request)) @@ -986,11 +987,11 @@ def users(request): # default else: objects_list = Paginator(User.objects.all().order_by('-reputation'), USERS_PAGE_SIZE) - base_url = '/users/?sort=%s&' % sortby + base_url = '/%s?sort=%s&' % (_('users/'), sortby) else: sortby = "reputation" objects_list = Paginator(User.objects.extra(where=['username like %s'], params=['%' + suser + '%']).order_by('-reputation'), USERS_PAGE_SIZE) - base_url = '/users/?name=%s&sort=%s&' % (suser, sortby) + base_url = '/%s?name=%s&sort=%s&' % (_('users/'), suser, sortby) try: users = objects_list.page(page) @@ -1166,8 +1167,8 @@ def user_recent(request, user_id, user_view): self.type_id = type self.title = title self.summary = summary - self.title_link = u'/questions/%s/%s#%s' %(question_id, title, answer_id)\ - if int(answer_id) > 0 else u'/questions/%s/%s' %(question_id, title) + self.title_link = u'/%s%s/%s#%s' %(_('questions/'),question_id, title, answer_id)\ + if int(answer_id) > 0 else u'/%s%s/%s' %(_('questions/'), question_id, title) class AwardEvent: def __init__(self, time, type, id): self.time = time @@ -1406,9 +1407,9 @@ def user_responses(request, user_id, user_view): def __init__(self, type, title, question_id, answer_id, time, username, user_id, content): self.type = type self.title = title - self.titlelink = u'/questions/%s/%s#%s' % (question_id, title, answer_id) + self.titlelink = u'/%s%s/%s#%s' % (_('questions/'), question_id, title, answer_id) self.time = time - self.userlink = u'/users/%s/%s/' % (user_id, username) + self.userlink = u'/%s%s/%s/' % (_('users/'), user_id, username) self.username = username self.content = u'%s ...' % strip_tags(content)[:300] @@ -1741,7 +1742,7 @@ def __generate_comments_json(obj, type, user): "add_date" : comment.added_at.strftime('%Y-%m-%d'), "text" : comment.comment, "user_display_name" : comment_user.username, - "user_url" : "/users/%s/%s" % (comment_user.id, comment_user.username), + "user_url" : "/%s%s/%s" % (_('users/'), comment_user.id, comment_user.username), "delete_url" : delete_url }) @@ -2003,9 +2004,9 @@ def search(request): if keywords is None: return HttpResponseRedirect('/') if search_type == 'tag': - return HttpResponseRedirect('/tags/?q=%s&page=%s' % (keywords.strip(), page)) + return HttpResponseRedirect('/%s?q=%s&page=%s' % (_('tags/'), keywords.strip(), page)) elif search_type == "user": - return HttpResponseRedirect('/users/?q=%s&page=%s' % (keywords.strip(), page)) + return HttpResponseRedirect('/%s?q=%s&page=%s' % (_('users/'), keywords.strip(), page)) elif search_type == "question": template_file = "questions.html" |