I create a class IAgenda and set value_type=schema.Datetime() and it works. I can add a list of datetimes in my agenda object
class IAgenda(model.Schema):
dates = schema.List(
title=_(u"label_dates", default=u"Dates"),
description=_(u"help_dates", default=u"Enter dates"),
value_type=schema.Datetime(),
required=True,
)
But when I tried to use a class IInterval on dates I got an error on save: 'unicode' object has no attribute 'year'.
class IInterval(Interface):
start = schema.Datetime(
title=_(u"label_start", default=u"Start"),
description=_(u"help_start", default=u"Enter a start date"),
required=True,
)
end = schema.Datetime(
title=_(u"label_end", default=u"End"),
description=_(u"help_end", default=u"Enter an end date"),
required=True,
)
class IAgenda(model.Schema):
dates = schema.List(
title=_(u"label_dates", default=u"Dates"),
description=_(u"help_dates", default=u"Enter dates"),
value_type=schema.Object(IInterval),
required=True,
)
If I change start and end fields to Int I got another error: "The system could not process the given value". So, what is the correct way to use dexterity/forms to add a list of custom objects?