Trying to set a relation field to a Dexterity content type i get the following error when i try to create new content:
2017-02-22 10:12:25 ERROR Zope.SiteErrorLog 1487754745.270.794031734041 http://ploneprod.semicinternet.local:18081/fs-prova/testsgerard/++add++Banner
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module plone.z3cform.layout, line 66, in __call__
Module plone.z3cform.layout, line 50, in update
Module plone.dexterity.browser.add, line 130, in update
Module plone.z3cform.fieldsets.extensible, line 59, in update
Module plone.z3cform.patch, line 30, in GroupForm_update
Module z3c.form.group, line 132, in update
Module z3c.form.form, line 136, in updateWidgets
Module z3c.form.field, line 257, in update
Module zope.component._api, line 109, in getMultiAdapter
ComponentLookupError: ((<z3c.relationfield.schema.Relation object at 0x7f29634db9d0>, <HTTPRequest, URL=http://ploneprod.semicinternet.local:18081/fs-prova/testsgerard/++add++Banner>), <InterfaceClass z3c.form.interfaces.IFieldWidget>, u'')
I read around the internet and seems that it could be because it doesn't finds the view, but i don't know why:
My interfaces.py file:
# -- coding: utf-8 --
"""Module where all interfaces, events and exceptions live."""
from contenttype.banner import _
from zope import schema
from plone.supermodel import model
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from plone.namedfile import field
from z3c.relationfield import Relation
class IContenttypeBannerLayer(IDefaultBrowserLayer):
"""Marker interface that defines a browser layer."""
class IBanner(model.Schema):
title = schema.TextLine(
title=_(u'Title'),
required=True,
)
description = schema.Text(
title=_(u'Description'),
required=False,
)
image = field.NamedImage(
title=_(u'Image'),
required=True,
)
button_text = schema.TextLine(
title=_(u'Button text'),
required=True,
default=_(u'More information'),
)
external_link = schema.URI(
title=_(u'External link'),
required=False,
)
internal_link = Relation(
title=_(u'Internal link'),
required=False,
)
from z3c.relationfield.interfaces import IHasRelations
from persistent import Persistent
from zope.interface import implements
class Banner(Persistent):
implements(IBanner, IHasRelations)
def __init__(self):
self.internal_link = None