match4everyone / match4everything

Other
7 stars 0 forks source link

Change all routes to end in slashes #157

Closed bjrne closed 4 years ago

bjrne commented 4 years ago

After a quick research, I think the best practice is for links to have a trailing slash, and to redirect links without one to that url (which is built-in behaviour of django, like documented here).

Currently, routes whose paths do not end in slashes but are entered with one, result in a 404.

There is more information on the to-slash-or-not-to-slash from Google from 2010.

Do you have any take on this @maltezacharias?

bjrne commented 4 years ago

This answer on stackoverflow also talks about it and recommends slashes, but at the end it says:

You can't make POST/PUT/PATCH/DELETE methods to work with rest_framework unless you explicitly define APPEND_SLASH=False in settings and trailing_slash=False for each and every router you gotta use(if you use Routers). It is like you basically gonna skip this most times and you gotta waste a hell lot of time debugging this. Django recommends append slashes and doesn't force it.

So if we use the REST api for the filtering, this would be a heads-up for #81

maltezacharias commented 4 years ago

For the rest framework it sounds annoying, still I'd prefer trailing slashes. Your research also points towards that.