mikemets
(Mike Metcalfe)
May 16, 2023, 9:57am
1
I’ve added a new Birthdate column to QuerySelectWidget but now in the pulldown the date appears as a full datetime value with date, time and timezone. Any ideas where I should format that to just display the date part?
ramonski
(Ramon Bartl)
May 17, 2023, 6:47am
2
Hi Mike,
please use the new implementation here:
senaite:2.x
← senaite:new-uidreference-widget
opened 08:45PM - 11 Apr 23 UTC
## Description of the issue/feature this PR addresses
This PR integrates the … new DX compatible UID reference widget for all AT reference fields
## Current behavior before PR
Old widget is used for AT reference fields
## Desired behavior after PR is merged
New widget is used for AT reference fields
--
I confirm I have tested this PR thoroughly and coded it according to [PEP8][1]
and [Plone's Python styleguide][2] standards.
[1]: https://www.python.org/dev/peps/pep-0008
[2]: https://docs.plone.org/develop/styleguide/python.html
Here you can provide an IReferenceWidgetDataProvider
to convert the date into a localized string:
senaite:2.x
← senaite:new-uidreference-widget
opened 08:45PM - 11 Apr 23 UTC
## Description of the issue/feature this PR addresses
This PR integrates the … new DX compatible UID reference widget for all AT reference fields
## Current behavior before PR
Old widget is used for AT reference fields
## Desired behavior after PR is merged
New widget is used for AT reference fields
--
I confirm I have tested this PR thoroughly and coded it according to [PEP8][1]
and [Plone's Python styleguide][2] standards.
[1]: https://www.python.org/dev/peps/pep-0008
[2]: https://docs.plone.org/develop/styleguide/python.html
To do the same with the current implementation, you would probably need to override the API URL endpoint and provide a custom version where you provide the data in the right format immediately.
mikemets
(Mike Metcalfe)
May 17, 2023, 10:41am
3
Thanks @ramonski . The new reference widget looks great but I’m going to have to money patch the old one for now to hit my deadline
ramonski
(Ramon Bartl)
May 17, 2023, 10:54am
4
There is no need to monkey patch. Just set a custom api_url
property on your widget and you should be good to go:
https://github.com/senaite/senaite.core/pull/2177
"""
security = ClassSecurityInfo()
_properties = TypesWidget._properties.copy()
_properties.update({
"macro": "senaite_widgets/queryselectwidget",
"query": {},
"limit": 25,
"catalog": "portal_catalog",
"api_url": None,
"disabled": False,
"readonly": False,
"multi_valued": False,
"allow_user_value": False,
"search_wildcard": True,
"value_key": "uid",
"padding": 3,
"display_template": None,
"hide_input_after_select": False,
})
ramonski
(Ramon Bartl)
May 17, 2023, 10:57am
5
Just keep in mind that it might be that you have to rework it once the PR is merged.