1👍
✅
Your form
has no action
attribute, so the GET will be directed to the current url, that is to say /search_form/1234/
. If you want to direct it to another url, add an action
attribute. For instance
<form method="get" action="/search_form/">
This will yield the url /search_form/?search=7426
if 7426
is selected. You also need to modify the view:
def search_form(request, xid=None):
# Same here
If you don’t want to hardcode /search_form/
, you can add another named url in your patterns, like
url(r'^search_form/$', views.search_form, name='base_search_form')
And
<form method="get" action="{% url 'base_search_form' %}">
Source:stackexchange.com