wuttaweb.forms.widgets
¶
Form widgets
This module defines some custom widgets for use with WuttaWeb.
However for convenience it also makes other Deform widgets available in the namespace:
deform.widget.Widget
(base class)
- class wuttaweb.forms.widgets.FileDownloadWidget(request, *args, **kwargs)[source]¶
Widget for use with
FileDownload
fields.This only supports readonly, and shows a hyperlink to download the file. Link text is the filename plus file size.
This is a subclass of
deform.widget.Widget
and uses these Deform templates:readonly/filedownload
- Parameters:
request – Current request object.
url – Optional URL for hyperlink. If not specified, file name/size is shown with no hyperlink.
- class wuttaweb.forms.widgets.NotesWidget(**kw)[source]¶
Widget for use with “notes” fields.
In readonly mode, this shows the notes with a background to make them stand out a bit more.
Otherwise it effectively shows a
<textarea>
input element.This is a subclass of
deform.widget.TextAreaWidget
and uses these Deform templates:textarea
readonly/notes
- class wuttaweb.forms.widgets.ObjectRefWidget(request, url=None, *args, **kwargs)[source]¶
Widget for use with model “object reference” fields, e.g. foreign key UUID => TargetModel instance.
While you may create instances of this widget directly, it normally happens automatically when schema nodes of the
ObjectRef
(sub)type are part of the form schema; viawidget_maker()
.In readonly mode, this renders a
<span>
tag around themodel_instance
(converted to string).Otherwise it renders a select (dropdown) element allowing user to choose from available records.
This is a subclass of
deform.widget.SelectWidget
and uses these Deform templates:select
readonly/objectref
- class wuttaweb.forms.widgets.PermissionsWidget(request, session=None, *args, **kwargs)[source]¶
Widget for use with Role
permissions
field.This is a subclass of
WuttaCheckboxChoiceWidget
. It uses these Deform templates:permissions
readonly/permissions
- class wuttaweb.forms.widgets.RoleRefsWidget(request, session=None, *args, **kwargs)[source]¶
Widget for use with User
roles
field. This is the default widget for theRoleRefs
type.This is a subclass of
WuttaCheckboxChoiceWidget
.
- class wuttaweb.forms.widgets.UserRefsWidget(request, session=None, *args, **kwargs)[source]¶
Widget for use with Role
users
field. This is the default widget for theUserRefs
type.This is a subclass of
WuttaCheckboxChoiceWidget
; however it only supports readonly mode and does not use a template. Rather, it generates and renders aGrid
showing the users list.
- class wuttaweb.forms.widgets.WuttaCheckboxChoiceWidget(request, session=None, *args, **kwargs)[source]¶
Custom widget for
set
fields.This is a subclass of
deform.widget.CheckboxChoiceWidget
, but adds Wutta-related params to the constructor.- Parameters:
request – Current request object.
session – Optional db session to use instead of
wuttaweb.db.sess.Session
.
It uses these Deform templates:
checkbox_choice
readonly/checkbox_choice