#urls.py
places_url_regex = ur'''
^places
(
(?:/types/(?P<types>\d+(?:-\d+)*))
|
(?:/cuisines/(?P<cuisines>\d+(?:-\d+)*))
|
(?:/avg-bills/(?P<avg_bills>\d+(?:-\d+)*))
|
(?:/cities/(?P<cities>\d+(?:-\d+)*))
|
(?:/sectors/(?P<sectors>\d+(?:-\d+)*))
|
(?:/streets/(?P<streets>\d+(?:-\d+)*))
|
(?:/special/(?P<special>[cabins|calian|children\-animation|children\-room|parking|summer\-verandah|vip-room|wifi|smokers\-room]+))
|
(?:/with/(?P<w>[discounts]+))
|
(?:/page/(?P<page>\d+))
)*
/$
'''
places_url_regex = re.sub( ur'\s+', '', places_url_regex )
urlpatterns = patterns( '',
url( places_url_regex, 'app.places.views.places', name = 'url_places' ),
)
#views.py
def places(request, page = 1, special = '', types = '', cuisines = '', avg_bills = '', cities = '', sectors = '', streets = '', w = ''):
...
, если я вручную открываю URL /places/types/10/
в адресной строке или в шаблоне {% url url_places %}
, это работает, но в шаблоне {% url url_places types=10 %}
возникает исключение:
Caught NoReverseMatch while rendering: Reverse for 'url_places' with arguments '()' and keyword arguments '{'types': 10}' not found.
Почему и как исправить?