Regex for uuid hex value in django urls

Viewed 5166

I am generating a uuid value and want to receive it from url in django, but the regex i am writing is not working and telling me page not found

import uuid
id = uuid.uuid4().hex
print id
be00e546822945bbb193b4ed80149c35

urls.py

urlpatterns = [
       url(r'^users/(?P<user_id>[0-9a-f]{32}\Z)/$', UserDetails.as_view(), name = 'users_detail'),
]

Result:

"GET /users/be00e546822945bbb193b4ed80149c35/ HTTP/1.1" 404 3302

So what would be the correct regex for uuid hex value in urls.py ?

2 Answers
Related