On Tue, Sep 27, 2011 at 11:49 AM, Anthony <[email protected]> wrote: > In Field(), represent defaults to None -- you have to specify a represent > function of your own. > Anthony >
Ah, I see. Is there a way to leverage the representations defined in SQLFORM.factory for this? SQLFORM.factory worked to a certain degree for my needs, but it also did not give me much freedom to design the view the way I wanted. Instead, I've ended up creating this "model" with the fields that I want, and I'm placing them one by one in the view. The actual "widgets" that were rendered by SQLFORM.factory were just fine - so can I use those somehow? Matt > On Tuesday, September 27, 2011 11:46:58 AM UTC-4, Matt wrote: >> >> On Tue, Sep 27, 2011 at 11:41 AM, Anthony <[email protected]> wrote: >> > Do you need the field's widget or it's represent (they're two different >> > things)? Note, the represent attribute is a function/callable (usually a >> > lambda) that takes a value (and optionally a record), so if you want to >> > use >> > it directly, you have to call it and pass a value to it. >> > {{=A.B.represent(your_value, optional_record)}} >> > Would be similar for the widget. >> > Anthony >> > >> >> From what I read in the source, I determined that was how to do it. >> However, when I try to call represent that way I'm getting an error >> that the 'NoneType' object is not callable. >> >> This is what I've got: >> >> model: >> class Test: >> name = Field('name', 'string') >> >> view: >> {{=terminal.name.represent("test")}} >> >> Matt >> >> > On Tuesday, September 27, 2011 11:19:08 AM UTC-4, Matt wrote: >> >> >> >> Hello, >> >> Is there a way to specify a value for the representation of a Field >> >> object? I have a class (lets call it A) with a Field object member >> >> variable (lets call it B), in my view I call {{=A.B.represent}} in >> >> order to display the default widget for this field. I would like to >> >> "fill" that widget with a value as well, is that possible? >> >> >> >> Matt >> > >

