So I have probably the simplest task you could ever wish for with an html form that I cannot solve.
I want to input a brand name into a search bar, click submit and it redirect to the url/brand/[input]
I already have a working view for the urls setup in django. How would I structure the form to actually create my desired url?
<form method="GET" action="">
<input type="text" name="brand" id="brand" placeholder="Search..." aria-label="Search">
<button type="submit">Search</button>
</form>
views.py
class GetByBrand(ListView):
def get(self, request, brand):
urls.py
urlpatterns = [
path('', GetListView.as_view(), name='home'),
path('brands/<str:brand>/', GetByBrand.as_view())
]