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

Jan-Wijbrand Kolman janwijbrand at gmail.com
Tue Feb 17 07:11:14 EST 2009

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()


More information about the Grok-dev mailing list