Cartridge Cart Error

99 views
Skip to first unread message

Josh B

unread,
Nov 14, 2012, 3:30:07 AM11/14/12
to mezzani...@googlegroups.com
Not quite sure where or if I broke it. But for some reason any time I try and use the update cart button, either remove or change quantity. It throws an error:

MultiValueDictKeyError at /shop/cart/

"Key 'items-0-id' not found in <QueryDict: {u'update_cart': [u'Update Cart'], u'items-1-quantity': [u'2'], u'items-TOTAL_FORMS': [u'2'], u'items-0-quantity': [u'3'], u'items-INITIAL_FORMS': [u'2'], u'csrfmiddlewaretoken': [u'WHFvD526lOOAvdquvkSlTY5ORQLdyPen'], u'items-MAX_NUM_FORMS': [u'']}>"
Request Method: POST
Request URL: http://127.0.0.1:8000/shop/cart/
Django Version: 1.4.2
Exception Type: MultiValueDictKeyError
Exception Value:
"Key 'items-0-id' not found in <QueryDict: {u'update_cart': [u'Update Cart'], u'items-1-quantity': [u'2'], u'items-TOTAL_FORMS': [u'2'], u'items-0-quantity': [u'3'], u'items-INITIAL_FORMS': [u'2'], u'csrfmiddlewaretoken': [u'WHFvD526lOOAvdquvkSlTY5ORQLdyPen'], u'items-MAX_NUM_FORMS': [u'']}>"

Ken Bolton

unread,
Nov 14, 2012, 7:59:35 AM11/14/12
to mezzanine-users
Hi Josh,

Is that the full stack trace?

ken

Josh B

unread,
Nov 15, 2012, 1:04:34 AM11/15/12
to mezzani...@googlegroups.com

MultiValueDictKeyError at /shop/cart/

"Key 'items-0-id' not found in <QueryDict: {u'items-MAX_NUM_FORMS': [u''], u'items-TOTAL_FORMS': [u'1'], u'items-0-quantity': [u'1'], u'items-INITIAL_FORMS': [u'1'], u'csrfmiddlewaretoken': [u'WHFvD526lOOAvdquvkSlTY5ORQLdyPen'], u'update_cart': [u'Update Cart']}>"
Request Method: POST
Request URL: http://127.0.0.1:8000/shop/cart/
Django Version: 1.4.2
Exception Type: MultiValueDictKeyError
Exception Value:
"Key 'items-0-id' not found in <QueryDict: {u'items-MAX_NUM_FORMS': [u''], u'items-TOTAL_FORMS': [u'1'], u'items-0-quantity': [u'1'], u'items-INITIAL_FORMS': [u'1'], u'csrfmiddlewaretoken': [u'WHFvD526lOOAvdquvkSlTY5ORQLdyPen'], u'update_cart': [u'Update Cart']}>"
Exception Location: /Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/site-packages/django/utils/datastructures.py in __getitem__, line 258
Python Executable: /Users/jbatchelor/.virtualenvs/puraforce/bin/python
Python Version: 2.7.2
Python Path:
['/Users/jbatchelor/Sites/puraforce-remedies',
 '/Users/jbatchelor/Sites/puraforce-remedies/puraforce',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python27.zip',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/plat-darwin',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/plat-mac',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/jbatchelor/.virtualenvs/puraforce/Extras/lib/python',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/lib-tk',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/lib-old',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/site-packages',
 '/Users/jbatchelor/.virtualenvs/puraforce/lib/python2.7/site-packages/PIL']
Server time:


Wed, 14 Nov 2012 23:03:04 -0700

Josh B

unread,
Nov 16, 2012, 2:21:51 AM11/16/12
to mezzani...@googlegroups.com
I think its related to me adding EXTRA_MODEL_FIELDS.
    (
        "cartridge.shop.models.Product.subcategories",
        "ManyToManyField",
        ("main.SubCategories",),
        {"verbose_name":"Product Sub-Categories",},
    ),

Which fails when I try to create a schemamigration in South. Any ideas? 

Ken Bolton

unread,
Nov 16, 2012, 10:28:52 AM11/16/12
to mezzanine-users
Hi Josh,

Categories, as a sub-class of Page, can already be nested. That field injection example is duplicating existing functionality. You are not the first developer I've seen attempt exactly this before realizing Cartridge already has it.

HTH.

best,
ken
Message has been deleted

Geoffrey Sechter

unread,
Jul 27, 2013, 6:46:33 PM7/27/13
to mezzani...@googlegroups.com
This error was tripping for me recently. The issue ended up being that when I was customizing my cart template from the base Cartridge provides, I inadvertently deleted the {{ form.id }} tag, resulting in the MultiValueDictKeyError. Adding it back into my template resolved the error.
Reply all
Reply to author
Forward
0 new messages