[Zope3-Users] Re: Recipe with default values
Marco Mariani
marco at sferacarta.com
Tue Feb 21 11:16:23 EST 2006
Philipp von Weitershausen wrote:
> I presume, this is what you want:
>
> class Recipe(Persistent):
>
> def __init__(self):
> self.creation_date = datetime.datetime.now()
>
Thanks for the reply.
That's the idea, but it works only if I don't add creation_field to the
add view:
<addform
label="Add Foo"
name="AddFoo.html"
schema="sandbox.interfaces.IFoo"
content_factory="sandbox.foo.Foo"
fields="title"
permission="zope.ManageContent"
/>
When fields="title", the creation_date attribute is set upon creation
and available for later editing.
When fields="title creation_date", the creation date is proposed as
empty in the add form. I'd like it to be already set when the add form
is called.
More information about the Zope3-users
mailing list