моя проблема в том, что когда поле «Имя пользователя и Пароль» оставлено пустым, отображается сообщение об ошибке "(представление PatientInfo.views.login_check не возвращает объект HttpResponse.")
здесь я использую обработчик входа длямоя страница входа по умолчанию и login_check, когда он успешно войдет.здесь, оставляя поле имени пользователя или пароля пустым, он не возвращает response.even я использовал HttpResponseRedirect, как указано ниже, но он не работает.
def login(request):
template = "../templates/admin/login.html"
data ={}
return render_to_response( template, data,
context_instance = RequestContext( request ) )
def login_check(request):
user = request.POST['username']
pas = request.POST['password']
if (user is None or pas is None):
if (user != "aa" and pas != "aa"):
return HttpResponseRedirect('/login/')
else:
if (user == "aa" and pas =="aa"):
template = "../templates/admin/index.html"
data = {}
return render_to_response( template, data, context_instance = RequestContext( request ) )