You can create a diagram based on a model:
from plone.supermodel import model class IMySchema(model.Schema): model.load('path/to/model.xml')
Any fields defined in the Python schema will take precedence over those with the same name as in the model.
The model loads at the end of the ZCML configuration phase. This means that there is a caveat: You cannot refer to a field from a model in the module area anywhere. For example, registering the default value with the @ form.default_value decorator (IMySchema ['foo']) will not work, since the field has not yet been loaded while the decorator is executing during import.
source share