Open sif77 opened 9 years ago
I need to use common fields with multiple content types.
I read schema.txt, but it does not work.
File my.project.basecontent.py :
class IBaseContent(Interface): test1 = zope.schema.TextLine(title=u"Test 1") test2 = zope.schema.TextLine(title=u"Test 2")
File my.project.mycontenttype.py : ... class IMyContentType(model.Schema, IImageScaleTraversable): model.load("models/mycontenttype.xml") ...
File my.project.models/mycontenttype.xml :
<?xml version="1.0" ?> <model xmlns="http://namespaces.plone.org/supermodel/schema" xmlns:form="http://namespaces.plone.org/supermodel/form" xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:domain="my.project">
<schema based-on="my.project.basecontent.IBaseContent"> <field name="field1" type="zope.schema.TextLine"> <title i18n:translate="">Field 1</title> <description /> <required>True</required> </field> <field name="field2" type="zope.schema.TextLine"> <title i18n:translate="">Field 2</title> <description /> <required>True</required> </field> </schema>
I can see field1 and field2 but none of common fields (test1, ...)
Thanks
I need to use common fields with multiple content types.
I read schema.txt, but it does not work.
File my.project.basecontent.py :
class IBaseContent(Interface): test1 = zope.schema.TextLine(title=u"Test 1") test2 = zope.schema.TextLine(title=u"Test 2")
File my.project.mycontenttype.py : ... class IMyContentType(model.Schema, IImageScaleTraversable): model.load("models/mycontenttype.xml") ...
File my.project.models/mycontenttype.xml :
<?xml version="1.0" ?> <model xmlns="http://namespaces.plone.org/supermodel/schema" xmlns:form="http://namespaces.plone.org/supermodel/form" xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:domain="my.project">
I can see field1 and field2 but none of common fields (test1, ...)
Thanks