我正在尝试创建一个搜索字段,每当我搜索任何内容时,都会出现此错误User_Model matching query does not exist.
* User_Model是一个表
views.py
def searchForMembers(request):
ser = request.GET['member']
allMembers = User.objects.filter(username=ser)
return render(request, 'memberMembersPage.html', {'memberList': allMembers})
html页面
<form class="navbar-form navbar-left" method="get" action="{%url 'searchForMembers'%}">
{%csrf_token%}
<div class="form-group">
<input type="text" class="form-control" placeholder="Search for a member" name="member">
</div>
</form>
urls.py
path('search/', views.searchForMembers, name='searchForMembers')