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