Package reahl.web.bootstrap.files

Added in version 3.2.

Styled Inputs that allow a user to choose or upload files.

FileInputButton

class reahl.web.bootstrap.files.FileInputButton(form, bound_field)

Bases: WrappedInput

A single button which activates the browser’s file choice dialog when clicked. The chosen file will only be uploaded once the user clicks on any Button associated with the same Form as this Input.

Parameters:
get_js(context=None)

Override this method if your Widget needs JavaScript to be activated on the browser side.

FileInput

class reahl.web.bootstrap.files.FileInput(form, bound_field)

Bases: WrappedInput

A visual combination of a two buttons and a status area. When the user clicks on the ‘Choose file’ button, the browser’s file choice dialog is activated. Once chosen the file name that was chosen is shown in the status area. The last button will upload this file when clicked (it is automatically clicked if the user’s JavaScript is enabled).

Parameters:
get_js(context=None)

Override this method if your Widget needs JavaScript to be activated on the browser side.

FileUploadInput

class reahl.web.bootstrap.files.FileUploadInput(form, bound_field, ignore_concurrency_change=False)

Bases: Input

A Widget that allows the user to upload several files. FileUploadInput makes use of JavaScript to save a user some time: once you choose a file, it is immediately uploaded to the server in the background so that you can continue choosing more files.

Controls are provided so you can cancel uploads that are in progress or remove ones that have finished. While a file is uploading a progress bar is also shown.

Parameters:

Changed in version 5.0: Subclass of Input and not PrimitiveInput

Changed in version 5.0: Added ignore_concurrency_change

get_concurrency_hash_strings()

Yields one or more strings representing the database value of this Widget.

This is used to determine whether or not the database has changed since a page was rendered, because if it did, the page is considered out of date and needs to be refreshed.

By default only Input participate in this algorithm, but you may override this method for your Widget subclass to make it participate as well - presuming it can somehow be related to a value in the database.

Added in version 5.0.