没有登录的时候自动跳转到登录页面,修改相关测试

This commit is contained in:
virusdefender
2015-08-23 20:45:02 +08:00
parent b590ee8577
commit f682aa1fb3
4 changed files with 10 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
# coding=utf-8
from functools import wraps
from django.http import HttpResponse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.utils.timezone import now
@@ -30,7 +30,7 @@ def check_user_contest_permission(func):
if request.is_ajax():
return error_response(u"请先登录")
else:
return error_page(request, u"请先登录")
return HttpResponseRedirect("/login/")
# kwargs 就包含了url 里面的播或参数
if "contest_id" in kwargs: