[Grok-dev] How do I get current day as default in interface schema definition?

Sebastian Ware sebastian at urbantalk.se
Tue Feb 17 11:26:54 EST 2009


Thanks! This works perfectly.

Mvh Sebastian


17 feb 2009 kl. 13.11 skrev Jan-Wijbrand Kolman:

> On Tue, Feb 17, 2009 at 12:41 PM, Sebastian Ware <sebastian at urbantalk.se 
> > wrote:
>> I am realising that the current schema definition default value is
>> useless since it is evaluated only at startup. Is there some way to
>> get grok to reevaluate the default value in a schema definition at
>> runtime? Or is there some other recommended way of passing the  
>> current
>> day as default to the add form?
>
> Something like this perhaps:
>
>  class MyAddForm(grok.AddForm):
>      ...
>      form_fields = grok.AutoFields(IMyInterface)
>      form_fields['mydatefield'].get_rendered = lambda x:  
> datetime.date.today()
>      ...
>
> HTH
> regards,
> jw



More information about the Grok-dev mailing list