referencewidgetfieldplone

Plone - removing <No reference> option from ReferenceWidget


When I use ReferenceField with ReferenceWidget, there are always options which refer to real objects, and one, on the top, named <No reference>. It is possible to hide that option?


Solution

  • Yes, set the required property of the field to True.

    ReferenceField(
        name='references',
        required=True,
        # ...
    )