db.mytable.field1.default=request.vars.field2
On Apr 5, 1:12 pm, Jose <[email protected]> wrote:
> I need to fill a field with the same value of another field of the
> same table. I do the following thing:
>
> db.define_table('mytable',
> SQLField('field1', length=10, writable=False),
> ...
> SQLField('field2', length=10),
> ...
> )
>
> db.mytable.field1.default = db.mytable.field2
>
> But a mistake takes is produced.
>
> Traceback (most recent call last):
> File "/usr/home/jose/web2py/gluon/restricted.py", line 98, in
> restricted
> exec ccode in environment
> File "/usr/home/jose/web2py/applications/capc/controllers/
> appadmin.py", line 271, in <module>
> File "/usr/home/jose/web2py/gluon/globals.py", line 75, in <lambda>
> self._caller = lambda f: f()
> File "/usr/home/jose/web2py/applications/capc/controllers/
> appadmin.py", line 102, in insert
> if form.accepts(request.vars, session):
> File "/usr/home/jose/web2py/gluon/sqlhtml.py", line 561, in accepts
> self.vars.id = self.table.insert(**fields)
> File "/usr/home/jose/web2py/gluon/sql.py", line 1307, in insert
> query = self._insert(**fields)
> File "/usr/home/jose/web2py/gluon/sql.py", line 1302, in _insert
> sql_v = ', '.join(vs)
> TypeError: sequence item 0: expected string, SQLField found
>
> What must I do?
>
> Regards
> Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---