diff --git a/rest_framework_docs/templates/rest_framework_docs/base.html b/rest_framework_docs/templates/rest_framework_docs/base.html
index 8102c5c..3d3887d 100644
--- a/rest_framework_docs/templates/rest_framework_docs/base.html
+++ b/rest_framework_docs/templates/rest_framework_docs/base.html
@@ -39,9 +39,9 @@
-
diff --git a/rest_framework_docs/templates/rest_framework_docs/home.html b/rest_framework_docs/templates/rest_framework_docs/home.html
index 13333cb..98f43f1 100644
--- a/rest_framework_docs/templates/rest_framework_docs/home.html
+++ b/rest_framework_docs/templates/rest_framework_docs/home.html
@@ -70,8 +70,10 @@
{% endfor %}
- {% else %}
+ {% elif not query %}
There are currently no api endpoints to document.
+ {% else %}
+ No endpoints found for {{ query }}.
{% endif %}
{% endblock %}
diff --git a/rest_framework_docs/views.py b/rest_framework_docs/views.py
index 9f58155..3b0012b 100644
--- a/rest_framework_docs/views.py
+++ b/rest_framework_docs/views.py
@@ -15,5 +15,12 @@ def get_context_data(self, **kwargs):
context = super(DRFDocsView, self).get_context_data(**kwargs)
docs = ApiDocumentation()
- context['endpoints'] = docs.get_endpoints()
+ endpoints = docs.get_endpoints()
+
+ query = self.request.GET.get("search", "")
+ if query and endpoints:
+ endpoints = [endpoint for endpoint in endpoints if query in endpoint.path]
+
+ context['query'] = query
+ context['endpoints'] = endpoints
return context
diff --git a/tests/tests.py b/tests/tests.py
index ac0b4ef..b23b60d 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -40,6 +40,16 @@ def test_index_view_with_endpoints(self):
# The view "OrganisationErroredView" (organisations/(?P[\w-]+)/errored/) should contain an error.
self.assertEqual(str(response.context["endpoints"][8].errors), "'test_value'")
+ def test_index_search_with_endpoints(self):
+ url = "%s?search=reset-password" % reverse("drfdocs")
+ print(url)
+ response = self.client.get(url)
+
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(len(response.context["endpoints"]), 2)
+ self.assertEqual(response.context["endpoints"][1].path, "/accounts/reset-password/confirm/")
+ self.assertEqual(len(response.context["endpoints"][1].fields), 3)
+
@override_settings(REST_FRAMEWORK_DOCS=SETTINGS_HIDE_DOCS)
def test_index_view_docs_hidden(self):
"""