return redirct("/idnex/")
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
return HttpResponseRedirect(reverse('别名'))
return HttpResponseRedirect(reverse('别名', args=(参数,)))
url(r'^login_cbv/$', views.Login.as_view())
视图函数
from django.views import View
class Login(View):
def get(self, request):
return render(request, "login_cbv.html")
def post(self, request):
return HttpResponse("cbv_OK")