I would like to query using a HTML form from a template, for example: index.html, and render the data in a different template, results.html.
This was the solution for this same problem but in 2011 (I'm working with the newest version of Django so this is not working anymore)
<form class="body_form" method="GET" action="{% url 'results' 'var_name' %}" autocomplete="off">
<input name="var_name" type="text">
Post: Django - is not a registered namespace
Is the syntax in the form field or in the input field right or this is an obsolet? I have the following error when I try this:
Reverse for 'results' with arguments '('var_name',)' not found. 1 pattern(s) tried: ['results']
views.py
def results(request,var_name):
context = {'var': var_name,}
return render(request, 'results.html', context)
urls.py
url(r'^results', results, name="results"),
Also, can I parse more than 1 variable using this method?