mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-02 19:40:13 +03:00
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:
parent
f5c34926d6
commit
9440c86c4a
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user