flask_admin.contrib.fileadmin
¶
-
class
FileAdmin
(base_path, *args, **kwargs)[source]¶ Simple file-management interface.
Parameters: - base_path – Path to the directory which will be managed
- base_url – Optional base URL for the directory. Will be used to generate static links to the files. If not defined, a route will be created to serve uploaded files.
Sample usage:
import os.path as op from flask_admin import Admin from flask_admin.contrib.fileadmin import FileAdmin admin = Admin() path = op.join(op.dirname(__file__), 'static') admin.add_view(FileAdmin(path, '/static/', name='Static Files'))
-
can_upload
= True¶
-
can_delete
= True¶
-
can_delete_dirs
= True¶
-
can_mkdir
= True¶
-
can_rename
= True¶
-
allowed_extensions
= None¶
-
editable_extensions
= ()¶
-
list_template
= 'admin/file/list.html'¶
-
upload_template
= 'admin/file/form.html'¶
-
mkdir_template
= 'admin/file/form.html'¶
-
rename_template
= 'admin/file/form.html'¶
-
edit_template
= 'admin/file/form.html'¶
-
delete
(*args, **kwargs)¶ Delete view method
-
download
(*args, **kwargs)¶ Download view method.
Parameters: path – File path.
-
edit
(*args, **kwargs)¶ Edit view method
-
index_view
(*args, **kwargs)¶ Index view method
Parameters: path – Optional directory path. If not provided, will use the base directory
-
mkdir
(*args, **kwargs)¶ Directory creation view method
Parameters: path – Optional directory path. If not provided, will use the base directory
-
rename
(*args, **kwargs)¶ Rename view method
-
upload
(*args, **kwargs)¶ Upload view method
Parameters: path – Optional directory path. If not provided, will use the base directory