rest_framework.urlpatterns

Module Contents

_get_format_path_converter(suffix_kwarg, allowed)
apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_route=None)
format_suffix_patterns(urlpatterns, suffix_required=False, allowed=None)

Supplement existing urlpatterns with corresponding patterns that also include a ‘.format’ suffix. Retains urlpattern ordering.

urlpatterns:
A list of URL patterns.
suffix_required:
If True, only suffixed URLs will be generated, and non-suffixed URLs will not be used. Defaults to False.
allowed:
An optional tuple/list of allowed suffixes. eg [‘json’, ‘api’] Defaults to None, which allows any suffix.