嘿伙计们,我正在使用 django 开发一个项目管理网站,The view equipo.frontends.views.hoddashboard didn't return an HttpResponse object
当我验证用户登录到仪表板时出现此错误。
我的views.py如下:
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.views.generic.simple import direct_to_template
from django.template.loader import get_template
from django.template import Context
from django.forms import *
from django.contrib.auth import authenticate
from django.contrib import auth
from django.http import HttpResponseRedirect
def hoddashboard(request):
if request.method=='POST':
username=request.POST.get('Username')
password=request.POST.get('Password')
user=authenticate(username=username,password=password)
if user is not None:
auth.login(request, user)
team="team.png"
t={'team1':team}
return HttpResponseRedirect('/home/aditya/Desktop/equipo/equipo/frontend /templates/hodnewdash.html')
我的html页面如下:
<html>
<head>
<title>hod-login</title>
<style type="text/css">.hod2{position:absolute;left:160;top:150;}
.hod1{position:absolute;left:870;top:180;}
.hod2{position:absolute;left:160;top:150;}
</style>
</head>
<body>
<div style='position:absolute;z-index:0;left:0;top:0;width:100%;height:100%'>
<img src='{{MEDIA_URL}}hod.png' style='width:100%;height:100%' alt='[]' />
</div>
<img height="300" width="450" class="hod2" src="{{MEDIA_URL}}hod1.jpeg" />
{%block content %}
<form action="hodnewdash.html" class="hod1" method="POST" name="hodlogin">{% csrf_token %}
<label>Username:</label><input type="text" name="uname" size="20"> </input><br />
<br />
<label>Password:</label><input type="password" name="pwd" value="" size="20" />
<br /><br />
<input type="submit" value="submit" name="submit" />
<input type="hidden" name="next" value="hodnewdash.html" />
</form>
{% endblock %}
</body>
</html>