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 39
39
40
40
<!-- Collect the nav links, forms, and other content for toggling -->
41
41
< 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 ">
43
43
< 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 ">
45
45
</ div >
46
46
</ form >
47
47
< 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">
70
70
</ div >
71
71
72
72
{% endfor %}
73
- {% else %}
73
+ {% elif not query %}
74
74
< 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 >
75
77
{% endif %}
76
78
77
79
{% endblock %}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def get_context_data(self, **kwargs):
17
17
docs = ApiDocumentation ()
18
18
endpoints = docs .get_endpoints ()
19
19
20
- query = self .request .GET .get ("q " , None )
20
+ query = self .request .GET .get ("search " , "" )
21
21
if query and endpoints :
22
22
endpoints = [endpoint for endpoint in endpoints if query in endpoint .path ]
23
23
You can’t perform that action at this time.
0 commit comments