Hi David,
This isn't something that we've designed for, but I think it should be possible with a bit of digging into Wagtail internals. You'll need to define a custom subclass of wagtail.wagtailadmin.edit_handlers.EditHandler which renders the HTML you want, and reference that from your model's panel definitions. It would be something like the following (untested):
from wagtail.wagtailadmin.edit_handlers import EditHandler
from django.utils.html import format_html
class BaseDisplayFooPropertyPanel(EditHandler):
def __init__(self, instance=None, form=None):
self.instance = instance
def render(self):
return format_html('<p>current value of foo: {0}</p>', self.instance.foo)
def DisplayFooPropertyPanel(some_custom_option):
# create a custom subclass of BaseDisplayFooPropertyPanel -
# this allows us to pass in any parameters we need from the panel definition
# so that we can refer to self.some_custom_option within BaseDisplayFooPropertyPanel
return type(str('_ DisplayFooPropertyPanel'), (BaseDisplayFooPropertyPanel,), {
'some_custom_option': some_custom_option
})
You would then include DisplayFooPropertyPanel(...) in your panel definitions. (Note that this API is changing in Wagtail 0.9 - DisplayFooPropertyPanel would become a class of its own, rather than a function that looks like one.
http://docs.wagtail.io/en/latest/releases/0.9.html#edithandler-internal-api-has-changed )
Cheers,
- Matt