Tell me, how can I take in urls uuid ?

 urlpatterns = [ url(r'^users/(?P<user_id>[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12})/$', UserDetails.as_view(), name = 'users_detail'), ] 

So, but it does not work.

  • Yes, I would take a wildcard. the fact that there user_id should be clear from the beginning of the URL. and to save myself from brute urls in this way I see no point. you still need to check for validity - eri

1 answer 1

(?P<user_id>[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})

Or you can just try (?P<user_id>[0-9a-f-]+)