Skip to content

Commit 7196819

Browse files
author
Emmanouil Konstantinidis
committed
Init search between endpoints
1 parent 66a940b commit 7196819

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

rest_framework_docs/views.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,12 @@ def get_context_data(self, **kwargs):
1515

1616
context = super(DRFDocsView, self).get_context_data(**kwargs)
1717
docs = ApiDocumentation()
18-
context['endpoints'] = docs.get_endpoints()
18+
endpoints = docs.get_endpoints()
19+
20+
query = self.request.GET.get("q", None)
21+
if query and endpoints:
22+
endpoints = [endpoint for endpoint in endpoints if query in endpoint.path]
23+
24+
context['query'] = query
25+
context['endpoints'] = endpoints
1926
return context

0 commit comments

Comments
 (0)