Re: Save partial state of a page when reloading

2019-10-13 Thread Robert Levasseur
Hi, 

I felt like I knew it was simple question haha, thanks so much for 
answering though! I will try all of these right away!

Thank you again!

On Saturday, October 12, 2019 at 12:15:00 AM UTC-4, WD Wang wrote:
>
> hi,
>
> I think It's not a django problem, it's a classic web developing problem.
>
> Http is stateless, if you want to 'save' something, you need to use 
> 1. URL param like the 'q=soccer'.
> 2. Use cookie/session.
>
> I think your problem can be solved by one of the methods below:
> 1. Use ajax to do the search, and use javascript to update the search 
> result, so the page will not be reload when doing search.
> 2. Put the search box and category check-boxes in one form, when the user 
> submit to search, the browser will also submit the categories check boxes, 
> so you know what the user selected, you can select them again in the 
> response html.
> 3. Use javascript to remember what category the user selected, and render 
> the selection when the page reloaded.
>
> On Sat, Oct 12, 2019 at 5:07 AM Robert Levasseur  > wrote:
>
>> Hi, 
>>
>> I'm very new to Django so this might be a silly question, but I'm having 
>> an issue with the filter functionality on my site's search page. I am using 
>> the django-haystack module to interface with the Whoosh search engine, and 
>> it functions by reloading the page while sending the query as a GET 
>> parameter. This means when someone runs the search, say for soccer, on the 
>> site it loads the page with a url /search/?q=soccer 
>> On the same page I have a from with a bunch of category check-boxes that 
>> I would like to use to filter the search results. I run into the problem 
>> however that if I submit the form and reload the page it does not remember 
>> the search text, and If I run the search and reload the page it does not 
>> remember which categories were selected.
>>
>> Is there a way in Django for me to pull both of these pieces of 
>> information and mess around with them in views.py, while maintaining the 
>> state of the category form and search box? Sorry if this is a strange 
>> question, and thanks for any help!
>>
>> Regards,
>> R. Eli
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a25b09a0-be13-4f18-8752-ea1bb6b9f1a0%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/a25b09a0-be13-4f18-8752-ea1bb6b9f1a0%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a5a01e79-3151-49ae-86ae-ff997a358eff%40googlegroups.com.


Save partial state of a page when reloading

2019-10-11 Thread Robert Levasseur
Hi, 

I'm very new to Django so this might be a silly question, but I'm having an 
issue with the filter functionality on my site's search page. I am using 
the django-haystack module to interface with the Whoosh search engine, and 
it functions by reloading the page while sending the query as a GET 
parameter. This means when someone runs the search, say for soccer, on the 
site it loads the page with a url /search/?q=soccer 
On the same page I have a from with a bunch of category check-boxes that I 
would like to use to filter the search results. I run into the problem 
however that if I submit the form and reload the page it does not remember 
the search text, and If I run the search and reload the page it does not 
remember which categories were selected.

Is there a way in Django for me to pull both of these pieces of information 
and mess around with them in views.py, while maintaining the state of the 
category form and search box? Sorry if this is a strange question, and 
thanks for any help!

Regards,
R. Eli

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a25b09a0-be13-4f18-8752-ea1bb6b9f1a0%40googlegroups.com.