Expand|Select|Wrap|Line Numbers
- def inventory(request):
- allObj=[]
- for i in Booking1.objects.all():
- #print i.booking_time
- invtime=i.booking_time
- t=str(invtime).split('.')[0]
- now=datetime.datetime.now()
- one_day=60*60*24
- diff=comp_dates(t,str(now).split('.')[0])
- print diff
- if diff>one_day:
- for a in CarModel.objects.all():
- qtyInStock=a.car_inventory
- orderQuantity = 1
- qtyLeft = int(qtyInStock) - int(orderQuantity)
- a.car_inventory=qtyLeft
- a.save()
- allObj=CarModel.objects.all()
- print allObj
- print "LLLLLLLLLLLLLLLLLL"
- return render_to_response("inventoryupdate.html", {'allObj':allObj})
- if not diff>one_day:
- return render_to_response("inventory.html")