def file_view(self, request, field_entry_id):
        """
        Output the file for the requested field entry.
        """
        model = self.fieldentry_model
        field_entry = get_object_or_404(model, id=field_entry_id)
        path = join(fs.location, field_entry.value)
        response = HttpResponse(content_type=guess_type(path)[0])
        f = open(path, "r+b")
        response["Content-Disposition"] = "attachment; filename=%s" % f.name
        response.write(f.read())
        f.close()
        return response
def file_view ( self , request , field_entry_id ) : model = self . fieldentry_model field_entry = get_object_or_404 ( model , id = field_entry_id ) path = join ( fs . location , field_entry . value ) response = HttpResponse ( content_type = guess_type ( path ) [ 0 ] ) f = open ( path , "r+b" ) response [ "Content-Disposition" ] = "attachment; filename=%s" % f . name response . write ( f . read ( ) ) f . close ( ) return response
Output the file for the requested field entry.