4👍
✅
Do
<input type="number" value="{{item.instock}}" name="item_{{item.id}}">
Then
if request.method == 'POST':
data = request.POST.dict()
data.pop('csrfmiddlewaretoken', None)
for i in data.items():
obj = Item.objects.get(id=i[0].split("_")[1])
if not str(obj.instock) == str(i[1]): #here check int or char datatype since 1 not equal "1"
obj.instock = i[1]
obj.save()
Source:stackexchange.com