Re: Add support for multiple path converters on urls.path()

2019-09-02 Thread Marco Silva
Hey, Thank you for your feedback. Making a new URL definition is a good approach, even though the example I gave would require a few extra lines, that may be more readable than squeezing everything together. Regarding the custom converter, I already have custom converters in place, and I don'

Re: Add support for multiple path converters on urls.path()

2019-08-31 Thread Adam Johnson
Hi Marco, Thanks for writing a clear, short proposal. This could be neat, but I'm against it for these reasons: - It's extra syntax - the advantage of the new URL syntax is that it's very simple and easy to pick up. It's copied from Flask, which also doesn't support a "multiple converte

Re: Add support for multiple path converters on urls.path()

2019-08-30 Thread Richard
A possibility without changes to Django is to create a generic converter and apply it to each model: class ModelUUIDConverter: regex= r'[a-fA-F0-9]{32}' def __init__(self, model): self.model = model def to_python(self, value): return self.model.objects.filter(Q(uuid=value)|Q(

Add support for multiple path converters on urls.path()

2019-08-30 Thread Marco Silva
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 veri