Layout Widget#
- class WidgetIndex(*args, **kwargs)[source]#
Bases:
Block
- add_widget(widget, title=None, icon=None)[source]#
Add
widget
the index with titletitle
and iconicon
.If
title
isNone
, look for a title onwidget.title
. If that is alsoNone
, default to the name of the widget class.If
icon
isNone
, look for an icon onwidget.icon
. If that is alsoNone
, default to the Bootstrap Icons “gear” icon.
- get_context_data(*args, **kwargs)[source]#
Update the template context dictionary used when rendering this block.
- Keyword Arguments:
**kwargs – the current context dictionary
- Returns:
The updated context dictionary
- class WidgetIndexItem(widget: wildewidgets.widgets.base.Widget, title: str, icon: str = 'gear')[source]#
Bases:
object
- class WidgetListLayout(title: str, sidebar_title: Optional[str] = None, sidebar_width: Optional[int] = None, sidebar_breakpoint: Optional[str] = None, **kwargs)[source]#
Bases:
Block
This class provides a two column layout. The first column is the sidebar containing links to the various widgets in the right column, and the second column is the main content, consisting of the contained widgets vertically stacked.
Example
>>> layout = WidgetListLayout('My Page') >>> layout.add_sidebar_form_button('Update', reverse('core:thing--update')) >>> layout.add_widget(Widget1(), title='another title') >>> layout.add_widget(Widget2(), title='the title', icon='stuff') >>> layout.add_widget(Widget3())
- Keyword Arguments:
title – The title of the widget.
sidebar_title – the title of the sidebar column
sidebar_width – the width in columns of the sidebar column
- class WidgetListMainWidget(*args, **kwargs)[source]#
Bases:
Block
- get_context_data(*args, **kwargs) Dict[str, Any] [source]#
Update the template context dictionary used when rendering this block.
- Keyword Arguments:
**kwargs – the current context dictionary
- Returns:
The updated context dictionary
- class WidgetListSidebarWidget(*args, title: Optional[str] = None, width: int = 3, breakpoint: str = 'xl', bare_widgets: Optional[List[Widget]] = None, actions: Optional[List[Widget]] = None, **kwargs)[source]#
Bases:
Block
- add_form_button(text: str, action: str, **kwargs)[source]#
Add
wildewidgets.FormButton
to the sidebar.You may also use any of the keyword arguments for
wildewidgets.FormButton
.
- add_link_button(text: str, url: str, **kwargs)[source]#
Add
wildewidgets.LinkButton
to the sidebar.You may also use any of the keyword arguments for
wildewidgets.LinkButton
.
- add_widget_to_index(widget: Widget, title: Optional[str] = None, icon: Optional[str] = None)[source]#
Add
widget
the index with titletitle
and iconicon
.If
title
isNone
, look for a title onwidget.title
. If that is alsoNone
, default to the name of the widget class.If
icon
isNone
, look for an icon onwidget.icon
. If that is alsoNone
, default to the Bootstrap Icons “gear” icon.
- get_context_data(*args, **kwargs) Dict[str, Any] [source]#
Update the template context dictionary used when rendering this block.
- Keyword Arguments:
**kwargs – the current context dictionary
- Returns:
The updated context dictionary