@@ -186,20 +186,19 @@ def return_device(request):
186
186
inventory .save ()
187
187
188
188
#-----------intentionally left here
189
- # reservations = Rental.objects.filter(event = rental.event, reservation = True)
190
- # rentals = Rental.objects.filter(event = rental.event, reservation = False, returned = False)
191
-
192
- # free_inventory = {}
193
- # for device in rental.event.devices.all():
194
- # free_inventory[device.name] = Inventory.objects.filter(event=rental.event, device=device, rented = False)
195
-
196
- # context = {
197
- # 'reservations' : reservations,
198
- # 'rentals' : rentals,
199
- # 'free_inventories': free_inventory,
200
- # }
201
- # return render(request, 'partials/manager_partial.html', context)
202
- return HttpResponse ('Returned!' )
189
+ reservations = Rental .objects .filter (event = rental .event , reservation = True )
190
+ rentals = Rental .objects .filter (event = rental .event , reservation = False , returned = False )
191
+ free_inventory = {}
192
+ for device in rental .event .devices .all ():
193
+ free_inventory [device .name ] = Inventory .objects .filter (event = rental .event , device = device , rented = False )
194
+
195
+ context = {
196
+ 'reservations' : reservations ,
197
+ 'rentals' : rentals ,
198
+ 'free_inventories' : free_inventory ,
199
+ }
200
+ return render (request , 'partials/manager_partial.html' , context )
201
+ #return HttpResponse('Returned!')
203
202
204
203
205
204
@login_required
0 commit comments