def pic_view(request, newname): file = File() fileobj = file.getfile_by_newname(newname) filename = fileobj.name filename_resize = filename.replace('img', 'img_resize') pic_path = os.path.join('/static', filename) pic_resize_path = os.path.join('/static', filename_resize) return render(request, 'pic_view.html', {'pic_path':pic_path, 'pic_resize_path':pic_resize_path})
def all_share(request): file_dict = {} file = File() files = file.getfile_all() for file in files: filename = file.filename.name file_dict[file] = filename.replace('img', 'img_resize') return render(request, 'my_share.html', {'file_dict': file_dict})
def all_share(request): file_dict={} file = File() files = file.getfile_all() for file in files: filename = file.filename.name file_dict[file] = filename.replace('img', 'img_resize') return render(request, 'my_share.html', {'file_dict':file_dict})
def pic_view(request, newname): file = File() fileobj = file.getfile_by_newname(newname) filename = fileobj.name filename_resize = filename.replace('img', 'img_resize') pic_path = os.path.join('/static', filename) pic_resize_path = os.path.join('/static', filename_resize) return render(request, 'pic_view.html', { 'pic_path': pic_path, 'pic_resize_path': pic_resize_path })