def download_cog_file(request, pk): instance = get_object_or_404(models.ConvertedImage, pk=pk) check_read_perm(request.user, instance) af_id = instance.processed_image.file.id instance = get_object_or_404(ChecksumFile, pk=af_id) return HttpResponseRedirect(instance.get_url())
def get_object(self): obj = super().get_object() check_read_perm(self.request.user, obj) return obj
def download_image_file(request, pk): instance = get_object_or_404(models.Image, pk=pk) check_read_perm(request.user, instance) url = instance.file.get_url() return HttpResponseRedirect(url)