I am using the default SQLITE database. Yes I did change the field type
couple of times back and forth since doing it list:reference auth_user was
giving the same error. Basically I am making a notifier/tracker application
for the test automation team much like the i-tracker app available on
web2py website and the one that you have described in your videos. So I
have a table which stores, among other things, a field called assigned_to
that optionally takes i.e. is empty or is in db auth_user and is a single
entry and this works perfectly. But now i also want to have another
optional field of cc_list so that we can add more people in the cc for a
particular task or let it remain empty. I also have an auth.signature on
that table, don't know if that might be a reason for the error. So the
foreign key error comes up when the form is submitted.
On Jul 8, 2015 5:55 AM, "Massimo Di Pierro" <massimo.dipie...@gmail.com>
wrote:

> what database are you using? did you ever change the field type?
>
> On Tuesday, 7 July 2015 16:40:39 UTC-5, kulin shah wrote:
>>
>> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/IS5nViBP1TY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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