[Grok-dev] Using templates on forms with multiple actions?

Adam Summers adamsummers1 at me.com
Thu Nov 12 10:41:32 EST 2009


Hi all,

This is a simple question, I know, but I'm stumped.

lets say I have a grok.Form as follows:

class showData(grok.Form):
	grok.context(Restaurant)
	grok.name('vlh')

	form_fields = grok.Fields( f_date = schema.Date(title=u'Date'),
		 f_daycount = schema.Int(title=u'Number of Days'))

	@grok.action('Calculate!')
	 def calc(self, **data):
		 return str(self.context.getStats(data['f_date'],'BREAKFAST',2))

	 @grok.action('VLH!')
	 def calc2(self, **data):
		 return str(self.context.getVLHData(data['f_date'], 'BREAKFAST', data 
['f_daycount']))

As a result of the actions, I'm currently returning strings. But how  
can I use this calculated data in a template? Basically the results  
are lists of lists that I want to render in tables.

Any help would be much appreciated..

Thanks and Regards,
Adam



More information about the Grok-dev mailing list