Plain is headed towards 1.0! Subscribe for development updates →

 1from functools import cached_property
 2
 3from plain.toolbar import ToolbarPanel, register_toolbar_panel
 4
 5from .core import Observer
 6
 7
 8@register_toolbar_panel
 9class ObserverToolbarPanel(ToolbarPanel):
10    name = "Observer"
11    template_name = "toolbar/observer.html"
12    button_template_name = "toolbar/observer_button.html"
13
14    @cached_property
15    def observer(self):
16        """Get the Observer instance for this request."""
17        return Observer(self.request)
18
19    def get_template_context(self):
20        context = super().get_template_context()
21        context["observer"] = self.observer
22        return context