Widgets#
There are a number of general purpose widgets available, along with some supporting classes.
BasicMenu
LightMenu - Often used as a submenu beneath the main menu.
MenuMixin - Used for view classes that utilize menus.
TemplateWidget - A generic widget that gives you full control over both the content and the layout.
TabbedWidget - A widget that contains other widgets in a tabbed interface.
BasicHeader - A header widget that is a base class for widgets with right justified controls.
HeaderWithLinkButton - A header widget with a link button on the right.
HeaderWithModalButton - A header widget with a modal button on the right.
ModalWidget - A Bootstrap modal dialog widget base class.
CrispyFormModalWidget - A Boostrap modal dialog containing a crispy form.
WidgetStream - A container widget that contains a list of child widgets that are displayed sequentially.
CardWidget - A Bootstrap card widget that displays a child widget in its body.
CodeWidget - A widget that contains a block of syntax highlighted code.
MarkdownWidget - A widget that contains a block of rendered markdown text.
TemplateWidget#
A template widget encapsulates a defined UI element on a page. It consists of data, and the template to display the data:
class HelloWorldWidget(TemplateWidget):
template_name = 'core/hello_world.html'
def get_context_data(self, **kwargs):
kwargs['data'] = "Hello world"
return kwargs
TabbedWidget#
A tabbed widget contains other widgets in a tabbed interface. Tabs are added by called add_tab with the name to display on the tab, and the widget to display under that tab. It can be any type of wildewidgets widget:
class TestTabbedWidget(TabbedWidget):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
widgets = WidgetStream()
widgets.add_widget(Test1Header())
widgets.add_widget(Test1Table())
self.add_tab("Test 1", widgets)
widgets = WidgetStream()
widgets.add_widget(Test2Header())
widgets.add_widget(Test2Table())
self.add_tab("Test 2", widgets)