Saturday, August 17, 2013

Re: Capturing a search query + params in Django 1.5

On Saturday, 17 August 2013 20:04:22 UTC+1, Lloyd Dube wrote: 
Hi, 

I have a simple web application in which I have a search box. When a user enters a query in the box and hits "search", they get a list of results via a popular search API.

My issue is that I am using django-endless-pagination to paginate (no kidding!) the API response - after some formatting, of course. When I click next, the pagination appends url parameters. I am wondering which url pattern to use to capture said parameters. The url scheme is as follows:

http://127.0.0.1:8000/search/ -> works fine, goes to my search view.
http://127.0.0.1:8000/search/?page=2 -> after a user clicks on the pagination links. I have no url pattern to handle this.

I am no regex expert. I also do not have an XKCD tee :-/

SOS?

Thanks.

--
Regards,
Sithu Lloyd Dube

These are both caught by the pattern '^search/$'. Parameters after the ? are not part of the path, so are not processed in the URLconf, but are passed as part of request.GET, which you can examine in your view.
--
DR.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate