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 activated 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.
- form – (See
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.
- form – (See
FileUploadInput¶
-
class
reahl.web.bootstrap.files.
FileUploadInput
(form, bound_field, name=None, registers_with_form=True)¶ 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
)
-
create_html_widget
()¶ Override this in subclasses to create the HTMLElement that represents this Input in HTML to the user. .. versionadded: 3.2
-
get_value_from_input
(input_values)¶ Obtains the value received for this Input from the browser, given a
cgi.FieldStorage
containing name, value pairs of user input as sent by the browser. Override this method if your Input needs special handling to obtain its value.
- form – (See