Redirect to a url with query string in Django

Using reverse and passing the name of url we can redirect to url with query string:

#urls.py

url(r'^search/$', views.search, name="search_view")

#views.py

from django.shortcuts import redirect, reverse

# in method
return redirect(reverse('search_view') + '?item=4')

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)