From 43c038bfd5fa032b5a874e1937ec7b2003dd8c47 Mon Sep 17 00:00:00 2001 From: mago960806 Date: Tue, 15 Jan 2019 15:55:47 +0800 Subject: [PATCH] Fix the "regex problems" in the template at templatetags/api_endpoint.py --- rest_framework_docs/api_endpoint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework_docs/api_endpoint.py b/rest_framework_docs/api_endpoint.py index c691850..be88d31 100644 --- a/rest_framework_docs/api_endpoint.py +++ b/rest_framework_docs/api_endpoint.py @@ -23,7 +23,7 @@ def __init__(self, pattern, parent_regex=None, drf_router=None): self.callback = pattern.callback # self.name = pattern.name self.docstring = self.__get_docstring__() - self.name_parent = simplify_regex(parent_regex).strip('/') if parent_regex else None + self.name_parent = simplify_regex(parent_regex).strip('/').replace('\\', '') if parent_regex else None self.path = self.__get_path__(parent_regex) self.allowed_methods = self.__get_allowed_methods__() # self.view_name = pattern.callback.__name__ @@ -39,7 +39,7 @@ def __init__(self, pattern, parent_regex=None, drf_router=None): def __get_path__(self, parent_regex): regex = get_regex_pattern(self.pattern) if parent_regex: - return "/{0}{1}".format(self.name_parent, simplify_regex(regex)) + return "/{0}{1}".format(self.name_parent, simplify_regex(regex).replace('\\', '')) return simplify_regex(regex) def is_method_allowed(self, callback_cls, method_name):