websauna.system.crud.listing module¶
Listing views.
-
class
websauna.system.crud.listing.
Column
(id, name=None, renderer=None, header_template=None, body_template=None, getter=None, format=None, navigate_view_name=None, navigate_url_getter=None)[source]¶ Bases:
object
Define a column in a listing.
-
body_template
= 'crud/column_body.html'¶
-
format
= 'MM/DD/YYYY HH:mm'¶ Arrow formatting string
Get URL where clicking the link in the listing should go.
By default, navigate to “show” view of the resource.
Get the link where clicking this item should take the user.
By default, navigate to “show” view of the resource.
TODO: Switch resource/request argument order. :type resource:
Resource
:param resource: Traversal context :type request:Request
:param request: Current HTTP Request. :type view_name:Optional
[str
] :param view_name: Override class’navigate_view_name
.
-
get_value
(view, obj)[source]¶ Extract value from the object for this column.
Called in listing body.
-
getter
= None¶
-
header_template
= 'crud/column_header.html'¶
Callback get_navigate_url(request, resource) to resolve the link where the item this column should point to
-
-
class
websauna.system.crud.listing.
ControlsColumn
(id='controls', name='Actions', header_template='crud/column_header_controls.html', body_template='crud/column_body_controls.html')[source]¶ Bases:
websauna.system.crud.listing.Column
Render View / Edit / Delete buttons.
-
class
websauna.system.crud.listing.
FriendlyTimeColumn
(id, name, navigate_view_name=None, timezone=None, header_template=None, body_template='crud/column_body_friendly_time.html')[source]¶ Bases:
websauna.system.crud.listing.Column
Print both accurate time and humanized relative time.
-
class
websauna.system.crud.listing.
StringPresentationColumn
(**kwargs)[source]¶ Bases:
websauna.system.crud.listing.Column
Renders the default string presentation of the object.
You can change the stringify method:
StringPresentationColumn(formatter=my_func)
where my_func is callable:
my_func(value)