mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
Update rest_framework/urlpatterns.py
Co-authored-by: Tom Christie <tom@tomchristie.com>
This commit is contained in:
parent
f02d346ec0
commit
431830261b
|
@ -100,7 +100,8 @@ def format_suffix_patterns(urlpatterns, suffix_required=False, allowed=None):
|
|||
if len(allowed) == 1:
|
||||
allowed_pattern = allowed[0]
|
||||
else:
|
||||
allowed_pattern = f'({"|".join(allowed)})'
|
||||
allowed_cases = "|".join(allowed)
|
||||
allowed_pattern = f'({allowed_cases})'
|
||||
suffix_pattern = r'\.(?P<%s>%s)/?$' % (suffix_kwarg, allowed_pattern)
|
||||
else:
|
||||
suffix_pattern = r'\.(?P<%s>[a-z0-9]+)/?$' % suffix_kwarg
|
||||
|
|
Loading…
Reference in New Issue
Block a user