I want to make a Tuple (of dates) for a content type, where at least one date is required.
When I add the content type, we need to 'add the first'
Is there a way to have one 'pre added" , so we only need to add another if we want two or more ?
I want to make a Tuple (of dates) for a content type, where at least one date is required.
When I add the content type, we need to 'add the first'
Is there a way to have one 'pre added" , so we only need to add another if we want two or more ?
Check the documentation for Default values for fields on add forms if this is a Dexterity-based content type.
Great, this works:
def theDefaultValue():
return datetime.date.today() - datetime.timedelta(1)
class IDate(schema.Date):
date=schema.Date(
title=_(u"Dato"),
)
class IGabrielBehavior(form.Schema):
""" """
dates = schema.Tuple(
title=_(u"Datoer"),
required=True,
default = (theDefaultValue(),),
value_type=IDate(
title=_(u"Dato"),
)
)