File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
templates/rest_framework_docs Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 3939
4040 <!-- Collect the nav links, forms, and other content for toggling -->
4141 < div class ="collapse navbar-collapse " id ="drfdoc-navbar ">
42- < form class ="navbar-form navbar-right " role ="search ">
42+ < form method =" get " action =" . " class ="navbar-form navbar-right " role ="search ">
4343 < div class ="form-group ">
44- < input type ="text " class ="form-control " placeholder ="Search ">
44+ < input type ="text " class ="form-control " name =" search " value =" {{ query }} " placeholder ="Search ">
4545 </ div >
4646 </ form >
4747 < ul class ="nav navbar-nav navbar-right ">
Original file line number Diff line number Diff line change @@ -70,8 +70,10 @@ <h4 class="panel-title title">
7070 </ div >
7171
7272 {% endfor %}
73- {% else %}
73+ {% elif not query %}
7474 < h2 class ="text-center "> There are currently no api endpoints to document.</ h2 >
75+ {% else %}
76+ < h2 class ="text-center "> No endpoints found for {{ query }}.</ h2 >
7577 {% endif %}
7678
7779{% endblock %}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def get_context_data(self, **kwargs):
1717 docs = ApiDocumentation ()
1818 endpoints = docs .get_endpoints ()
1919
20- query = self .request .GET .get ("q " , None )
20+ query = self .request .GET .get ("search " , "" )
2121 if query and endpoints :
2222 endpoints = [endpoint for endpoint in endpoints if query in endpoint .path ]
2323
You can’t perform that action at this time.
0 commit comments