NoReverseMatch - 反向'步骤自动完成'参数'()'和关键字参数' {}'未找到。尝试过0种模式:[]

时间:2016-09-07 12:21:56

标签: python autocomplete views

首先,我意识到此问题已被多次提出过,但我已经查看了几个解决方案并且无法解决我的问题。此外,在我遇到此错误之前,我已经尝试了一些对我有用的事情,包括使用各种“返回重定向/反向/ http响应”#39;有争议,这些天堂也没有用。 我按照本教程https://github.com/yourlabs/django-autocomplete-light/blob/master/docs/tutorial.rst#id5创建自动填充字段,在第二阶段我进入shell并检查网址是否可以反转我得到NoReverseMatch错误。我的观点和网址如下。 视图:

jQuery(document).ready(function(){

    var glide = jQuery('.slider').glide({
        afterTransition : function() {
            console.log(glide.current());
        } 
    }).data('api_glide'); // data('api_glide') to get opportunity to use glide.current()

});

URL:

class StepAutoComplete(autocomplete.Select2QuerySetView):
    def get_queryset(self):
        # Don't forget to filter out results depending on the visitor !
        if not self.request.user.is_authenticated():
            return Step.objects.none()

        qs = Step.objects.all()

        if self.q:
            qs = qs.filter(name__istartswith=self.q)

        return qs

追溯:

from dal import autocomplete
from django.conf.urls import url
from django.contrib import admin
from buildpage import views
from .models import RouteStep, Step  
from .views import StepAutoComplete

app_name = 'Build Page'

urlpatterns = [
    url(r'^$', views.home, name='home'),
    url(r'^partrequestinfo/$', views.partrequestinfo, name='partrequestinfo'),
    url(r'^preparebuildlist/$', views.preparebuildlist, name='preparebuildlist'),
    url(r'^manufacturelist/$', views.manufacturelist, name='manufacturelist'),
    url(r'^preparebuildhome/$', views.preparebuildhome, name='preparebuildhome'),
    url(r'^step-autocomplete/$', StepAutoComplete.as_view(), name='step-autocomplete'),
    url(r'^partrequestprepare/$', views.partrequestprepare, name='partrequestprepare'),
    url(r'^(?P<slug>[\w-]+)/confirmation$', views.partrequestdetail, name='partrequestdetail'),
    url(r'^(?P<slug>[\w-]+)/delete$', views.partrequestdelete, name='partrequestdelete'),
    url(r'^(?P<slug>[\w-]+)/manufacturebuild$', views.manufacturebuild, name='manufacturebuild'),
    url(r'^(?P<slug>[\w-]+)/update$', views.preparebuildupdate, name='preparebuildupdate'),
]

0 个答案:

没有答案