Monday, April 15, 2013

Pagination with file upload (MultiValueDictKeyError)

I have a simple form that takes a user upload, queries a database, and displays results in a table.  I receive the following error whenever I try to go to the second, third, fourth, etc page:

MultiValueDictKeyError at /result/

"Key 'batch' not found in <MultiValueDict: {}>"
Request Method: GET
Request URL: http://xxx/result/?page=4
Django Version: 1.5
Exception Type: MultiValueDictKeyError
Exception Value:
"Key 'batch' not found in <MultiValueDict: {}>"
Exception Location: C:\Python27\lib\site-packages\django\utils\datastructures.py in __getitem__, line 295
Python Executable: C:\Python27\python.exe
Python Version: 2.7.3
Python Path:
['C:\\Users\\xx',   'C:\\Python27\\lib\\site-packages\\django_pagination-1.0.7-py2.7.egg',   'C:\\Windows\\system32\\python27.zip',   'C:\\Python27\\DLLs',   'C:\\Python27\\lib',   'C:\\Python27\\lib\\plat-win',   'C:\\Python27\\lib\\lib-tk',   'C:\\Python27',   'C:\\Python27\\lib\\site-packages']
Server time: Tue, 16 Apr 2013 00:48:23 -0400

I've found two possible causes: I'm using a "request.POST" on the objects I'm paginating when it should be a "request.GET".  The issue here is I believe I need to have this as a POST because I'm getting data from an uploaded file.

The second cause I do not understand, but it's at this link: https://django-pagination.googlecode.com/svn/trunk/docs/usage.txt under "A Note About Uploads".  I assume this is directed at implementing a paginator object in views.py, but my only pagination code are the tags in my results page template. 

Does anyone have experience with this issue and/or have a solution?

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate