不存在匹配查询搜索时出错

时间:2019-02-03 10:11:01

标签: django search django-templates

我正在尝试创建一个搜索字段,每当我搜索任何内容时,都会出现此错误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')

0 个答案:

没有答案