On Tuesday, May 18, 2010 18:47:41 [email protected] wrote:
> Hi to all,
> i found myself in a bit of situation, as it is the toscawidges forms
> are static,  and therefor loaded only once.
> 
> My situation is that several fields are loaded from db.
> 
> Example:
> 
> def createFieleds():
>         fields = list()
>         for b in BannerSizeModel.query.all():
>             label = "%s %sx%s (%s)" % (_('banner'),b.w ,
> b.h,_(b.name))
>             fields.append(FileField(id='bannerimg_%d' % b.id,
> label_text=label,
> 
> validator=validators.FieldStorageUploadConverter()))
> 
>         return fields
> 
> 
> and the form is;
> 
> class BannerForm(TableForm):
>     submit_text = _("Save")
>     fields = createFieleds()
> 
> 
> 
> in controller:
> 
> add_form = BannerTypesForm(action='/admin/bannertypes/create' )
> 
> @expose('wbs.templates.admin.bannertypes.edit')
> def add(self,**kw):
>     return dict(form=add_form,b=kw)
> 
> @validate(form=add_form,error_handler=add)
> @expose()
> def create(self,**kw):
>    do stuff....
> 
> 
> so the problem is where the DB is updated in run time , but the field
> list stays the same...
> 
> any idea how can i force field rebuild in run time ?

http://toscawidgets.org/documentation/ToscaWidgets/usage.html#callable-
parameters

Diez

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to