Let format suffixes and no-trailing slash work together

Swap the order that the new and existing urls are appended in
apply_suffix_patterns. This way, if a format is specified in the
request, it will be captured as the format kwargs instead of part of the
lookup parameter.
This commit is contained in:
Matt Long 2013-09-09 19:57:41 -07:00
parent f5c34926d6
commit 9440c86c4a

View File

@ -25,10 +25,10 @@ def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required):
view = urlpattern._callback or urlpattern._callback_str
kwargs = urlpattern.default_args
name = urlpattern.name
# Add in both the existing and the new urlpattern
# Add in both the new and the existing urlpattern
ret.append(url(regex, view, kwargs, name))
if not suffix_required:
ret.append(urlpattern)
ret.append(url(regex, view, kwargs, name))
return ret