I am pretty sure the error is not the code you showed us. You are
somwhere assigning something to =T(...) where it expects a string.

On Nov 21, 11:30 pm, Adrian Edwards <aedward...@gmail.com> wrote:
> Hello,
>
> I'm having difficulty getting inserts to work with tables that have
> references and I'm sure its something stupid I'm doing wrong.
> Hopefully you guys can point me in the right direction.
> I have the following 2 tables.
>
> db.define_table('event_users',
>     Field('event', 'reference events'),
>     Field('user_name', 'reference auth_user'),
>     Field('goal', 'double'),
>     Field('last_entry', 'date'),
>     format = lambda row: "%s - %s" % (row.event.name,
> row.user_name.first_name))
>
> db.define_table('entries',
>     Field('user', 'reference event_users'),
>     Field('date_entered', 'date'),
>     Field('value', 'double'),
>     format='%(user)s %(date_entered)s')
>
> I'm trying to insert a record into the entries table. I have the
> following SQLFORM to generate the view and then try to pre-populate
> date_entered and user. User is calculated and is equal to Reference
>
>     form = SQLFORM(db.entries)
>     form.date_entered = date.today()
>     form.user = user
>     if form.process().accepted:
>
> But the form won't submit. When I debug it through Eclipse it says
> "lazyT: value not in database"
>
> Any suggestions?
> thanks
> Adrian

Reply via email to