python - difficulty with search url in django -


i relatively new django , while trying implement search feature in site, having difficulty setting url in urls.py. search url dispatcher looks following:

url(r'search/$','welcome.views.search',name='search'),

also search form has action set 'search'.

there seems no problem search functionality every time repeat search, url looks pretty bad. example:

http://localhost:8000/search/search/search/search/?csrfmiddlewaretoken=1ziskyyhdogluhwokshkxo2ddhd8wotp&q=a

the above url obtained after trying 4 successive searches.please me out friends.

it seems giving relative path instead of absolute -

so use, href="/search/* instead of href="search/*.(replace star paramaters)

also use caret in regex(that stricter regex)

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

instead of

url(r'search/$','welcome.views.search',name='search'), 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -