def download_proxy_view(request, pk): delivery = lfs_get_object_or_404(DownloadDelivery, id=pk) if delivery.available: delivery.download_count += 1 delivery.downloaded_at = datetime.now() delivery.save() #Now, go look for the file and serve it. opath = delivery.asset.file.path dpath = os.path.dirname(opath) fname = os.path.basename(opath) return xsendfileserve(request=request, path=fname, document_root=dpath) else: return HttpResponseForbidden()
def manage_download_digital_product(request, asset_id): asset = get_object_or_404(DigitalAsset, pk=asset_id) opath = asset.file.path dpath = os.path.dirname(opath) fname = os.path.basename(opath) return xsendfileserve(request=request, path=fname, document_root=dpath)