What is causing this error? The inserts with the form used to work in
sqLite but now am getting this error using PostGres
form=SQLFORM.factory(db.SuperObject,db.Party,db.auth_user) ##
,db.PartyAddressIntersection,db.Address)
if form.process().accepted:
form.vars.displayName = form.vars.objectDisplayName =
'%(first_name)s %(last_name)s' % form.vars
superObjectID = form.vars.superObjectID =
db.SuperObject.insert(**db.SuperObject._filter_fields(form.vars))
response.flash='Thanks for filling the form'
partyID = form.vars.partyID =
db.Party.insert(**db.Party._filter_fields(form.vars))
user_id =
db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
form.vars.user_id = form.vars.personID = user_id # can't remember
why this is here...
form.vars.addressID =
db.Address.insert(**db.Address._filter_fields(form.vars))
db.PartyAddressIntersection.insert(**db.PartyAddressIntersection._filter_fields(form.vars))
db.Role.insert(roleOwner_user_id_FK = user_id, roleOwner_SuperObject_FK
= superObjectID, roleName='Self', roleDescription='Self',
roleOwner_party_FK=partyID, roleType_FK=specificRoleTypeID,
object_superObject_FK=superObjectID)
<type 'exceptions.SyntaxError'> Field roleOwner_user_id_FK does not belong
to the tableVersion
web2py™ Version 2.12.2-stable+timestamp.2015.08.09.14.29.44
Python Python 2.7.9: C:\alex\alt_web2py\web2py\web2py.exe (prefix:
C:\Python27)Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
Traceback (most recent call last):
File "C:\alex\alt_web2py\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
File "C:/alex/alt_web2py/web2py/applications/ES1/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/ES1/controllers/default.py>, line
7715, in <module>
File "C:\alex\alt_web2py\web2py\gluon\globals.py", line 412, in <lambda>
self._caller = lambda f: f()
File "C:/alex/alt_web2py/web2py/applications/ES1/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/ES1/controllers/default.py>, line
979, in add_new_person
db.Role.insert(roleOwner_user_id_FK = user_id, roleName='Self',
roleDescription='Self', roleOwner_party_FK=partyID,
roleType_FK=specificRoleTypeID, object_superObject_FK=superObjectID)
File "C:\alex\alt_web2py\web2py\gluon\packages\dal\pydal\objects.py", line
737, in insert
ret = self._db._adapter.insert(self, self._listify(fields))
File "C:\alex\alt_web2py\web2py\gluon\packages\dal\pydal\objects.py", line
655, in _listify
'Field %s does not belong to the table' % name)
SyntaxError: Field roleOwner_user_id_FK does not belong to the table
Error snapshot [image: help]
<http://127.0.0.1:8000/admin/default/ticket/ES1/127.0.0.1.2016-01-21.15-01-37.e079eb27-456f-45b8-a084-0a4b0d509e66#>
<type 'exceptions.SyntaxError'>(Field roleOwner_user_id_FK does not belong
to the table)
(self=<Table Role
(id,roleOwnerSuperObjectID,roleOwner...e,created_on,created_by,modified_on,modified_by)>,
fields={'object_superObject_FK': 11L, 'roleDescription': 'Self',
'roleName': 'Self', 'roleOwner_party_FK': 10L, 'roleOwner_user_id_FK': 9L,
'roleType_FK': 39L}, update=False)
- Code listing
650.
651.
652.
653.
654.
655.
656.
657.
658.
659.
# store all fields passed as input in new_fields
for name in fields:
if not name in self.fields:
if name != 'id':
raise SyntaxError(
'Field %s does not belong to the table' % name)
else:
field = self[name]
value = fields[name]
if field.filter_in:
Variables
name 'roleOwner_user_id_FK'
thanks,
Alex Glaros
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.