更新用户个人主页的功能

This commit is contained in:
virusdefender
2015-10-25 15:30:11 +08:00
parent 30bfe5bef2
commit 05d9fb52ad
6 changed files with 140 additions and 70 deletions

View File

@@ -286,7 +286,17 @@ class ResetPasswordAPIView(APIView):
def user_index_page(request, username):
return render(request, "oj/account/user_index.html")
try:
user = User.objects.get(username=username)
except User.DoesNotExist:
return error_page(request, u"用户不存在")
blog_link = ""
if user.userprofile.blog:
blog_link = user.userprofile.blog.replace("http://", "").replace("https://", "")
return render(request, "oj/account/user_index.html", {"user": user, "blog_link": blog_link})
class SSOAPIView(APIView):