Hi, 
I am a newbie to web2py and programming in general. I have something like 
this:
Field('cc_list','list:integer',requires=IS_EMPTY_OR(IS_IN_DB(db,'auth_user.id',db.auth_user._format,multiple=True))),
but this is giving an error:
Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.

Traceback (most recent call last):
  File "/home/kulin/web2py/gluon/restricted.py", line 227, in restricted
    exec ccode in environment
  File "/home/kulin/web2py/applications/tester/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/tester/controllers/default.py>, line 
143, in <module>
  File "/home/kulin/web2py/gluon/globals.py", line 412, in <lambda>
    self._caller = lambda f: f()
  File "/home/kulin/web2py/gluon/tools.py", line 3583, in f
    return action(*a, **b)
  File "/home/kulin/web2py/applications/tester/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/tester/controllers/default.py>, line 
50, in create_details
    form = SQLFORM(db.post).process()
  File "/home/kulin/web2py/gluon/html.py", line 2301, in process
    self.validate(**kwargs)
  File "/home/kulin/web2py/gluon/html.py", line 2238, in validate
    if self.accepts(**kwargs):
  File "/home/kulin/web2py/gluon/sqlhtml.py", line 1688, in accepts
    self.vars.id = self.table.insert(**fields)
  File "/home/kulin/web2py/gluon/packages/dal/pydal/objects.py", line 691, in 
insert
    ret = self._db._adapter.insert(self, self._listify(fields))
  File "/home/kulin/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
731, in insert
    raise e
IntegrityError: FOREIGN KEY constraint failed

What am i doing wrong?

On Monday, December 6, 2010 at 8:50:55 AM UTC-8, rochacbruno wrote:
>
>
> Is there any important difference?
>
> 1.
> Field('assigned_to','list:integer',requires=IS_IN_DB(db,db.auth_user.id
> ,'db.auth_user.first_name',multiple=True)),
>
> 2.
> Field('assigned_to','list:reference auth_user'),
>
>
> In the case of 2, how to represent as 'db.auth_user.first_name' for 
> multiple users?
>
> -- 
>
> Bruno Rocha
> http://about.me/rochacbruno/bio
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to