tomchristie/django-rest-framework — pull request #1096 by mattlong (2013-09-10 03:09:13+00:00)
Title: Let format suffixes and no-trailing slash work together

Having trailing_slash=False on my Router with format suffixes optional is broken right now. The order of url regexes that will be checked is:

...
^mytype/(?P[^/]+)$
^mytype/(?P[^/]+)\.(?P[a-z]+)$
...

requesting mytype/123.json will match the first pattern, causing pk to be set to "123.json". This pull request will reverse the order those two regexes are checked and correctly set pk to "123" and format to "json".