hammygoonan
hammygoonan

Reputation: 2225

Django Urls with a dot

I'm trying to match a url like: /api/1.0/page/1

I've got my main urls.py file:

urlpatterns = [
    url(r'^api/1.0/', include('api_v1.urls')),
]

and then in my api_v1/urls.py file:

urlpatterns = [
    url(r'^page/(?P<page_id>[0-9]{4})/', views.page),
]

I feel like it should be simple but I can't get it to work.

Upvotes: 1

Views: 1387

Answers (1)

wim
wim

Reputation: 363053

Your regex enforces 4 character page ids. But your page id is just 1. Perhaps this pattern would work better:

r'^page/(?P<page_id>[0-9]+)/'

Upvotes: 2

Related Questions