urls.py中的语法错误。怎么调试呢?

时间:2011-02-24 08:58:31

标签: python django

错误就是这个

“\吨(r'ajax /查找/ ^ $”, 'ajaxlookup',名称= 'ajax_lookup'),\ n”))

我已经安装了geonode,并且我已经将ajax_select用于自动完成。但我的URLs.py给出了错误

我的urls.py看起来像这样

from django.conf.urls.defaults import patterns, url

js_info_dict = {
    'packages': ('geonode.maps',),
}

    urlpatterns = patterns('geonode.maps.views',
        (r'^$', 'maps'),
        url(r'^new$', 'newmap', name="map_new"),
        (r'^(?P<mapid>\d+)$', 'map_controller'),
        (r'^(?P<mapid>\d+)/view$', 'view'),
        (r'^(?P<mapid>\d+)/download/$', 'map_download'),
        (r'^check/$', 'check_download'),
        (r'^embed/$', 'embed'),
        (r'^(?P<mapid>\d+)/embed$', 'embed'),
        (r'^(?P<mapid>\d+)/data$', 'mapJSON'),
        url(r'^search/?$', 'maps_search_page', name='maps_search'),
        url(r'^search/api/?$', 'maps_search', name='maps_search_api'),
        url(r'^(?P<mapid>\d+)/ajax-permissions$', 'ajax_map_permissions', name='ajax_map_permissions'),
        url(r'^change-poc/(?P<ids>\w+)$', 'change_poc', name="change_poc"),
        url(r'^search/$', 'maps_search', name='maps_search'),

    )

    urlpatterns += patterns('geonode.ajax_select.views',
        (r'ajax/lookup/^$','ajaxlookup',name='ajax_lookup'),
    )

html文件中的模板如下所示

    <script type="text/javascript">
        Ext.onReady(function(){
           {% autoescape off %}

            var searchTable = new GeoNode.MapSearchTable({
                renderTo: 'search_results',
                trackSelection: true,
                permalinkURL: '{% url ajax_lookup %}',
                searchURL: '{% url ajax_lookup %}',
                searchParams: {{init_search}}
            });
        {% endautoescape %}
    });

</script>

我的ajax_lookup看起来像这样

2 个答案:

答案 0 :(得分:2)

元组不支持关键字参数。将条目转换为url()来电。

答案 1 :(得分:0)

它应该是:

urlpatterns += patterns('geonode.ajax_select.views',
        (r'^ajax/lookup/$','ajaxlookup',name='ajax_lookup'),
    )

“^”结束了:)