Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor widget hints so that DataGridField works #143

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/recensio/plone/browser/review.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from AccessControl.SecurityManagement import getSecurityManager
from html import escape
from plone import api
from plone.autoform.interfaces import WIDGETS_KEY
from plone.autoform.utils import _process_widgets
from plone.dexterity.utils import iterSchemata
from plone.memoize.view import memoize
from plone.supermodel.utils import mergedTaggedValueDict
from Products.Five.browser import BrowserView
from Products.PortalTransforms.libtransforms.utils import scrubHTML
from recensio.plone import _
Expand Down Expand Up @@ -74,6 +77,12 @@ def widgets(self):
"""
form = DisplayForm(self.context, self.request)
form.fields = Fields(*self.fields)

# honor widget hints so that DataGridField works
for schema in iterSchemata(self.context):
widget_hints = mergedTaggedValueDict(schema, WIDGETS_KEY)
_process_widgets(form, widget_hints, {}, form.fields)

widgets = getMultiAdapter((form, self.request, self.context), IWidgets)
widgets.mode = DISPLAY_MODE
widgets.ignoreContext = False
Expand Down Expand Up @@ -290,7 +299,7 @@ def get_metadata(self): # noqa: C901
label = self.get_label(field)
values = getattr(context, field)
if getattr(context, "isPermanentExhibition", False):
permanent_ex = _("Dauerausstellung").encode("utf-8")
permanent_ex = _("Dauerausstellung")
values = [
{
"place": value["place"],
Expand Down
Loading