def update_snapshots(request):
    if not request.user.is_superuser:
        return HttpResponse(status=403)
    save_snapshots()
    
    if 'next' in request.GET.keys():
        return HttpResponseRedirect(request.GET['next'])
    return HttpResponseRedirect("/")
def store_inventory(request):
    if not request.user.is_superuser:
        return HttpResponse(status=403)
    snapshots = InventorySnapshot.objects.filter(store="R").order_by("-date")
    if not snapshots.count():
        save_snapshots()
        snapshots = InventorySnapshot.objects.filter(store="R").order_by("-date")
    
    snapshot = snapshots[0]
    
    products = ProductInventorySnapshot.objects.filter(snapshot=snapshot)
    
    return render_to_response("inventory.html", {"type":"Store", "products":products})