In Field(), represent defaults to None -- you have to specify a represent 
function of your own.

Anthony

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

Reply via email to