def urls_paths(self, prefix: str): for path, path_view in self.operations.items(): path = path.replace("{", "<").replace("}", ">") route = "/".join([i for i in (prefix, path) if i]) # to skip lot of checks we simply treat double slash as a mistake: route = normalize_path(route) route = route.lstrip("/") yield django_path(route, path_view.get_view())
def urls_paths(self, prefix: str) -> Iterator[URLPattern]: prefix = replace_path_param_notation(prefix) for path, path_view in self.path_operations.items(): path = replace_path_param_notation(path) route = "/".join([i for i in (prefix, path) if i]) # to skip lot of checks we simply treat double slash as a mistake: route = normalize_path(route) route = route.lstrip("/") url_name = path_view.url_name or "" if not url_name and self.api: url_name = self.api.get_operation_url_name( path_view.operations[0], router=self ) yield django_path(route, path_view.get_view(), name=url_name)