Migrated search from POST to GET
This commit is contained in:
parent
0c19a69f76
commit
429a772f57
|
@ -13,8 +13,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<form class="form navbar-form" method="post" action="{% url "whoisdb:search" %}">
|
<form class="form navbar-form" method="get" action="{% url "whoisdb:search" %}">
|
||||||
{% csrf_token %}
|
|
||||||
<input class="textinput form-control" type="text" name="q" placeholder="Search in DB">
|
<input class="textinput form-control" type="text" name="q" placeholder="Search in DB">
|
||||||
<button class="btn btn-primary">Search</button>
|
<button class="btn btn-primary">Search</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
<div class="panel-heading">Search {% if term %}for {{ term }} - {{ results|length }} result{{results|length|pluralize:"s" }}{% else %}database{% endif %}</div>
|
<div class="panel-heading">Search {% if term %}for {{ term }} - {{ results|length }} result{{results|length|pluralize:"s" }}{% else %}database{% endif %}</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p>
|
<p>
|
||||||
<form class="form" method="post" action="{% url "whoisdb:search" %}">
|
<form class="form" method="get" action="{% url "whoisdb:search" %}">
|
||||||
{% csrf_token %}
|
|
||||||
<input type="text" name="q" placeholder="Search in DB">
|
<input type="text" name="q" placeholder="Search in DB">
|
||||||
<button class="btn btn-primary">Search</button>
|
<button class="btn btn-primary">Search</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -83,9 +83,7 @@ def showHandle(request, handle):
|
||||||
|
|
||||||
def searchObject(request):
|
def searchObject(request):
|
||||||
results = None
|
results = None
|
||||||
term = None
|
term = request.GET.get("q", None)
|
||||||
if request.method == "POST":
|
|
||||||
term = request.POST.get("q", None)
|
|
||||||
if term:
|
if term:
|
||||||
results = findInDatabase(term)
|
results = findInDatabase(term)
|
||||||
return render(request, "whoisdb/search.html", {"results": results, "term": term})
|
return render(request, "whoisdb/search.html", {"results": results, "term": term})
|
||||||
|
|
Loading…
Reference in New Issue