Simple file-management interface.
Parameters: |
|
---|
Sample usage:
admin = Admin()
path = op.join(op.dirname(__file__), 'static')
admin.add_view(FileAdmin(path, '/static/', name='Static Files'))
admin.setup_app(app)
Is file upload allowed.
Is file deletion allowed.
Is recursive directory deletion is allowed.
Is directory creation allowed.
Is file and directory renaming allowed.
List of allowed extensions for uploads, in lower case.
Example:
class MyAdmin(FileAdmin):
allowed_extensions = ('swf', 'jpg', 'gif', 'png')
List of editable extensions, in lower case.
Example:
class MyAdmin(FileAdmin):
editable_extensions = ('md', 'html', 'txt')
File list template
File upload template
Directory creation (mkdir) template
Rename template
Edit template
Is file download allowed.
Edit template
Return base path. Override to customize behavior (per-user directories, etc)
Index view method
Parameters: | path – Optional directory path. If not provided, will use the base directory |
---|
Verify if the provided path is accessible for the current user.
Override to customize behavior.
Parameters: | path – Relative path to the root |
---|
Verify if file can be uploaded.
Override to customize behavior.
Parameters: | filename – Source file name |
---|
Determine if the file can be edited.
Override to customize behavior.
Parameters: | filename – Source file name |
---|
Verify that directory is in base_path folder
Parameters: |
|
---|
Directory creation view method
Parameters: | path – Optional directory path. If not provided, will use the base directory |
---|
Perform some actions after a directory has successfully been deleted.
Called from delete method
By default do nothing.
Perform some actions after a file has been successfully changed.
Called from edit method
By default do nothing.
Perform some actions after a file has successfully been deleted.
Called from delete method
By default do nothing.
Perform some actions after a file has been successfully uploaded.
Called from upload method
By default do nothing.
Perform some actions after a directory has successfully been created.
Called from mkdir method
By default do nothing.
Perform some actions after a file or directory has been renamed.
Called from rename method
By default do nothing.
Save uploaded file to the disk
Parameters: |
|
---|
Upload view method
Parameters: | path – Optional directory path. If not provided, will use the base directory |
---|
Upload form class
alias of UploadForm