https://plonerestapi.readthedocs.io/en/querysources/customization.html#dexterity-fields
Says:
For customizing a specific field instance, a named IFieldSerializer adapter can be registered. The name may either be the full dottedname of the field (plone.app.dexterity.behaviors.exclfromnav.IExcludeFromNavigation.exclude_from_nav) or the shortname of the field (exclude_from_nav).
I can't seem to get the named adapter to work to override this 'featured_image' field:
Removing the 'name' from the zcml works - I'm just lucky I have only one IRelationChoice in my schema.
=====
The schema for 'IStory': ( rfasite.content.content.story.py )
class IStory(model.Schema):
# snip other fields
featured_image = RelationChoice(
title=_(u'Featured Image'),
# snip stuff
)
ZCML:
<adapter factory=".serializer.FeaturedImageField"
name="featured_image"
/>
(or)
<adapter factory=".serializer.FeaturedImageField"
name="rfasite.content.content.story.featured_image"
/>
serialize.py: - let's just catch it with a debug.
from rfasite.content.content.story import IStory
@adapter(IRelationChoice,IStory, Interface)
@implementer(IFieldSerializer)
class FeaturedImageField(DefaultFieldSerializer):
def __call__(self):
import pdb; pdb.set_trace()