Package reahl.web.bootstrap.files¶
New 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)¶ 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 sameForm
as this Input.- Parameters
form – (See
Input
)bound_field – (See
Input
, must be of typereahl.component.modelinterface.FileField
)
-
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)¶ 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 is the user’s JavaScript is enabled).
- Parameters
form – (See
Input
)bound_field – (See
Input
, must be of typereahl.component.modelinterface.FileField
)
-
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)¶ 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
form – (See
Input
)bound_field – (See
Input
, must be of typereahl.component.modelinterface.FileField
)ignore_concurrent_change – If True, don’t check for possible concurrent changes by others to this input (just override such changes).
Changed in version 5.0: Subclass of
Input
and notPrimitiveInput
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 yourWidget
subclass to make it participate as well - presuming it can somehow be related to a value in the database.New in version 5.0.