Permalink
Browse files

Fix mapping quantities to selected lines (backport)

Cherry-picked from 6a10fee.
  • Loading branch information...
1 parent 7f37255 commit e3625346215e8502575ff0191a8107ad7044e247 @bitrut bitrut committed with codeinthehole Apr 5, 2013
@@ -313,7 +313,10 @@ def post(self, request, *args, **kwargs):
return self.reload_page_response()
else:
line_ids = request.POST.getlist('selected_line')
- line_quantities = [int(qty) for qty in request.POST.getlist('selected_line_qty')]
+ line_quantities = []
+ for line_id in line_ids:
+ qty = request.POST.get('selected_line_qty_%s' % line_id)
+ line_quantities.append(int(qty))
lines = order.lines.filter(id__in=line_ids)
if lines.count() == 0:
messages.error(self.request, _("You must select some lines to act on"))
@@ -121,7 +121,7 @@ <h3>{% trans "Items ordered" %}</h3>
<tr>
<td>
<input type="checkbox" name="selected_line" value="{{ line.id }}" />
- <input type="text" name="selected_line_qty" value="{{ line.quantity }}" class="span1" size="2" />
+ <input type="text" name="selected_line_qty_{{ line.id }}" value="{{ line.quantity }}" class="span1" size="2" />
</td>
<td>{{ line.quantity }}</td>
<td>{{ line.title }}</td>

0 comments on commit e362534

Please sign in to comment.