I am using Django 3.0 and Python 3.7
here is my views.py
@login_required
def updated_status(request, pk):
s1 = []
purchase_quantity = Item.objects.filter(order_id=pk)
data = set()
a = [x.id for x in purchase_quantity if x.id not in data and not data.add(x.id)]
stock_quantity = Stock.objects.filter(other_id=pk)
data1 = set()
b = [x.other_item.id for x in stock_quantity if
x.other_item.id not in data1 and not data1.add(x.other_item.id)]
if data == data1:
for j in data1:
stock_quantity = Stock.objects.filter(other_order_id=pk,
other_item_id=j).aggregate(Sum('quantity'))
purchase_quantity = Item.objects.filter(
other_id=pk, id=j).aggregate(Sum('quantity'))
if stock_quantity > purchase_quantity:
Order.objects.filter(id=pk).update(flag=1)
if stock_quantity >= purchase_quantity:
s1.append('true')
else:
s1.append('false')
if 'false' in s1:
Order.objects.filter(id=pk).update(status=3)
else:
Order.objects.filter(id=pk).update(status=2)
else:
pass
return redirect(reverse('get_list_data'))
How could i solve this issue " TypeError: '>' not supported between instances of 'dict' and 'dict' "