Hello,
I am trying to get the cart work, but I am stuck with the following problem.
When I modify the quantity of an item in the cart, the cart_update view returns the cart as it is, without changes.
Here's the form to change the quantity (inside my custom cart template):
<!-- form to submit a quantity change -->
<form class="qtyform" id="qtyform-{{
cartitem.id}}" action="{% url cart_update %}" method="post">{% csrf_token %}
<div class="large-12 columns">
<input type="text" name="update_item_{{
cartitem.id}}" value="{{cartitem.quantity}}" />
<div class="update-btn">
<a href="#" onclick="$('#qtyform-{{
cartitem.id}}').submit();">
<img src="{{STATIC_URL}}images/update.png" alt="{% trans 'update' %}" />
<small>[{% trans 'update' %}]</small></a>
</div>
</div>
</form>
When I submit the form, the view is called with a
self.request.POST = <QueryDict: {u'csrfmiddlewaretoken': [u'd3vneua1mEFp2HJ7MGHtLoIKKFzq49sV'], u'update_item_1': [u'10']}>
Then the view fills a form_set with the line
formset = get_cart_item_formset(cart_items=context['cart_items'],
but it gets an error when, in the shop/forms.py-->get_cart_item_formset it tries to fill in the formset with the line:
form_set = CartItemFormSet(data, **kwargs)
The form does not make any use of the POST variable "item_update_ID=QTY".
I do not see where the code uses the information "item_update_ID=QTY, as suggested in the docs and in the views/cart.py-->CartDetails view.
Thank you very much,
Simone