File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ <h1 class="title" style="text-align: center">Search Tutorials</h1>
3333 < form action ="{% url 'app:search-results' %} " method ="get " onsubmit ="return checkEmpty() ">
3434 < div class ="field ">
3535 < div class ="control has-icons-left ">
36- < input class ="input is-rounded " name ="q " type ="search " placeholder ="search tutorials... " id ="search-bar ">
36+ < input class ="input is-rounded " name ="q " type ="search " placeholder ="search tutorials... " id ="search-bar " value =" {{ query }} " >
3737 < span class ="icon is-small is-left ">
3838 < i class ="fa fa-search " aria-hidden ="true "> </ i >
3939 </ span >
@@ -47,7 +47,11 @@ <h1 class="title" style="text-align: center">Search Tutorials</h1>
4747 < select name ="category ">
4848 < option disabled selected value =""> Select Category</ option >
4949 {% for category_value, category_name in categories %}
50- < option value ="{{ category_value }} "> {{ category_name }}</ option >
50+ < option value ="{{ category_value }} "
51+ {% if category_value == category %} selected {% endif %}
52+ >
53+ {{ category_name }}
54+ </ option >
5155 {% endfor %}
5256 </ select >
5357 </ div >
@@ -61,4 +65,4 @@ <h1 class="title" style="text-align: center">Search Tutorials</h1>
6165 </ div >
6266</ section >
6367{% block results %}{% endblock results %}
64- {% endblock content %}
68+ {% endblock content %}
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ def search_query(request):
5151
5252 context = {
5353 'query' : query ,
54+ 'category' : category ,
5455 'tutorials' : tutorials ,
5556 'total' : total ,
5657 'time' : result_time ,
You can’t perform that action at this time.
0 commit comments