2017-05-26 29 views
0

我这里有小问题就代码:Python的Django的分页和url.id

HTML代码:

a href="{% url 'entertainment:novelsView' novel.id %}">buttonclass="pull-right btn btn-primary btn-xs">Link span class="fa fa-link"</span></button</a 

view.py

def novelsView(request,novels_id): 
     novels=Novels.objects.filter(id=novels_id) 
     context={'novels':novels} 
     return render(request,"enter/novelsView.html",context) 

应用= urls.py

url(r'^novelsView/(?P<novels_id>[0-9]+)/$',views.novelsView,name="novelsView"), 

问题:

我正在使用分页查看数据,所以上面显示的是链接:使用ID呈现到另一个页面的锚标记。查看是好的,但如果我在分页e.g点击:< < [1] [2] >>点击2然后显示url : http://localhost:8000/enter/search/?page=2

错误:

MultiValueDictKeyError at /enter/search/ 

回答