moshthepitt / django-pagination

Automatically exported from code.google.com/p/django-pagination
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Problem with Posts Form data. #36

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When used with a view (for a search form) that uses Posts the first page is
fine, but the clicking on any of the paginator links just returns the view
of the form, not the results of the search. 

This is because a GET is being used.

Should perhaps clarify in the documentation that only GETS are supported. 

Thanks,

Original issue reported on code.google.com by Mountain...@gmail.com on 15 Jan 2009 at 12:36

GoogleCodeExporter commented 9 years ago
Any update on this ... 
I would prefer to just have an explaination on how to fix this ...
Is it just to convert all the POSTs in GETs ? ? ?

\T,

Original comment by tsm...@gmail.com on 15 Feb 2009 at 1:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Just handle the additional GET request in your view and there is nothing else 
that
needs to be done to resolve this issue.

Original comment by kachroo....@gmail.com on 17 Jul 2009 at 6:12

GoogleCodeExporter commented 9 years ago
It could probably be done a lot better, but this is very transparent and it 
allows the post to be accepted on the same page as the pagination, if that's 
useful.

    post_data = None

    if request.GET.get('page', None):
        # If the page variable exists, then pagination is active - serve the 
        # last post data from the session storage.
        if request.session.get('POST'):
            request.POST = request.session['POST']
            post_data = request.POST

    # Newer post data is more import than the cached value
    if request.method == 'POST': post_data = request.POST

    if post_data:
        form = FormThingForm(post_data)
        if form.is_valid():
            pass
            # ... Valid form stuff

Original comment by jagpa...@gmail.com on 21 Jun 2012 at 9:57