Layout Widget#

class WidgetIndex(*args, **kwargs)[source]#

Bases: Block

add_widget(widget, title=None, icon=None)[source]#

Add widget the index with title title and icon icon.

If title is None, look for a title on widget.title. If that is also None, default to the name of the widget class.

If icon is None, look for an icon on widget.icon. If that is also None, 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

block: str = 'widget-index'#

block is the official wildewidgets name of the block; it can’t be changed by constructor kwargs

template_name: str = 'wildewidgets/widget_index.html'#

The name of the template to use to render this widget

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

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

template_name: str = 'wildewidgets/widget-list.html'#

The name of the template to use to render this widget

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

block: str = 'widget-list__main'#

block is the official wildewidgets name of the block; it can’t be changed by constructor kwargs

css_class: Optional[str] = 'col'#

A string of CSS classes to apply to this block

template_name: str = 'wildewidgets/widget-list--main.html'#

The name of the template to use to render this widget

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

class Actions(widgets: Optional[List[Widget]] = None, **kwargs)[source]#

Bases: WidgetStream

css_class: str = 'px-3 py-4 d-flex flex-column align-items-stretch border bg-white shadow-sm'#

A string of CSS classes to apply to this block

class Widgets(widgets: Optional[List[Widget]] = None, **kwargs)[source]#

Bases: WidgetStream

block: str = 'widget-list__sidebar__widgets'#

block is the official wildewidgets name of the block; it can’t be changed by constructor kwargs

add_actions_widget(widget: Widget)[source]#

Add a widget to the sidebar inside the Actions box.

add_form_button(text: str, action: str, **kwargs)[source]#

Add wildewidgets.FormButton to the sidebar.

Parameters:
  • text (str) – use this as the button text

  • url (str) – the URL for the link button

You may also use any of the keyword arguments for wildewidgets.FormButton.

Add wildewidgets.LinkButton to the sidebar.

Parameters:
  • text (str) – use this as the button text

  • url (str) – the URL for the link button

You may also use any of the keyword arguments for wildewidgets.LinkButton.

add_widget(widget: Widget)[source]#

Add a widget to the sidebar outside the Actions box.

add_widget_to_index(widget: Widget, title: Optional[str] = None, icon: Optional[str] = None)[source]#

Add widget the index with title title and icon icon.

If title is None, look for a title on widget.title. If that is also None, default to the name of the widget class.

If icon is None, look for an icon on widget.icon. If that is also None, 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

block: str = 'widget-list__sidebar'#

block is the official wildewidgets name of the block; it can’t be changed by constructor kwargs

css_class: Optional[str] = None#

A string of CSS classes to apply to this block

template_name: str = 'wildewidgets/widget-list--sidebar.html'#

The name of the template to use to render this widget