Optional trailing slashes in Routers

333 views
Skip to first unread message

German Prostakov

unread,
Apr 13, 2018, 5:39:03 AM4/13/18
to Django REST framework
Is it possible to do without such workaround suggested on SO: https://stackoverflow.com/questions/46163838/how-can-i-make-a-trailing-slash-optional-on-a-django-rest-framework-simplerouter?
Is it planned to allow optional trailing space in Routers? I think I'm not the only one who thinks this is a lack of convenience, especially if you switch your backend to Django and you had optional trailing slashes in routes in previous backend framework (Express.js)

German Prostakov

unread,
Apr 13, 2018, 5:41:12 AM4/13/18
to Django REST framework
And I don't want to use Django auto redirects if there is no trailing slash (APPEND_SLASH = False)

Carlton Gibson

unread,
Apr 13, 2018, 5:55:36 AM4/13/18
to django-res...@googlegroups.com
Hi German, 

On 13 Apr 2018, at 11:39, German Prostakov <gpros...@gmail.com> wrote:

...without such workaround…

Given how simple the workaround is, I’d bet on “No” as to including such in DRF itself. (It’s just not worth the code and tests etc.) 

Maybe a PR on the docs with the example would be worthwhile. 

Kind Regards,

Carlton


Xavier Ordoquy

unread,
Apr 13, 2018, 5:58:00 AM4/13/18
to django-res...@googlegroups.com
The solution proposed on SO looks sensible to me.
I think the optional trailing slash is a bad idea because you won’t have a unique identifier for representation any longer.

Regards,
Xavier Ordoquy,
Linovia;

Le 13 avr. 2018 à 11:39, German Prostakov <gpros...@gmail.com> a écrit :

Is it possible to do without such workaround suggested on SO: https://stackoverflow.com/questions/46163838/how-can-i-make-a-trailing-slash-optional-on-a-django-rest-framework-simplerouter?
Is it planned to allow optional trailing space in Routers? I think I'm not the only one who thinks this is a lack of convenience, especially if you switch your backend to Django and you had optional trailing slashes in routes in previous backend framework (Express.js)

--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages