Jesse,

You need to change your code in the view to look at the GET parameter rather
than POST. Change this line:

query = request.POST['q']

to:

query = request.GET['q']

Also, make sure when you are submitting to your search page that you are
submitting the page with GET in the method of your form. Your second method
of checking if query is valid then inserting it into the href looks fine,
you just need to change which method you are accessing it in your view.

Micah

On Thu, Mar 12, 2009 at 1:16 PM, Jesse <adles...@gmail.com> wrote:

>
> Hello Micah,
>
> I tried this in the template:
> <a href="?q={% if query %}?{{ request.REQUEST.q }}{% endif %}&page=
> {{ publications.next_page_number }}">next</a>
>
> The browser URL is:
> http://127.0.0.1:8000/Search/?q=?&page=2
>
> and this in the template:
>
>  <a href="?q={% if query %}{{ query }}{% endif %}&page=
> {{ publications.next_page_number }}">next</a>
>
> The browser URL is:
> http://127.0.0.1:8000/Search/?q=harris&page=2,
>
> which is correct for q, but the error for both is still:
>
> Request Method:         GET
> Request URL:    http://127.0.0.1:8000/Search/
> Exception Type:         MultiValueDictKeyError
> Exception Value:
>
> Key 'q' not found in <QueryDict: {}>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to