Hello,

I'm on the process of migrating an app to django >2 and walked into this 
potencial new feature while converting the URLs.

Some modeles use a "display" id, like TICKET-2019-002, but it's pk is 
actually a uuid, so the url would ideally support both.

I've created a custom converter to verify the correct value, therefore I 
can use:
`path('api/ticket/<ticket:ticket>', TicketDetailView.as_view())`

but if i want to also expose the api with the uuid, I have to add another 
urlpattern with:
`path('api/ticket/<uuid:ticket>', TicketDetailView.as_view())`

my proposal would be to add support for this:
`path('api/ticket/<ticket|uuid:ticket>', TicketDetailView.as_view())`


The concrete example is a different use case, its a "common" view where you 
must specify the type first, so basically:
`path('api/<str:obj_type>/<ticket|task|epic|uuid:refecence_nr>/assign', 
GenericAssignView.as_view())`


>From what i've seen on the API, wouldn't be much work to add regex groups 
on the djanjo.urls.resolvers._route_to_regex method, but it also returns a 
converters dictionary with a mapping of parameters(the ticket, or 
refecence_nr) with a single converter, and that could cause problems 
somewhere...

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/706ffd8d-06b9-4c21-82d9-ee1c69e7aa69%40googlegroups.com.

Reply via email to