[web2py] Re: list reference with ondelete=set null breaking when delete parent

2015-03-10 Thread Francisco Costa
Hi Paolo, but how do you find the tables (and records) that use the deleted record as a Foreign Key? I don't know if those records should have the "is_active" set to False, or the Foreign Key set to None On Tuesday, 10 March 2015 07:34:22 UTC, Paolo Valleri wrote: > > ondelete is for reference

[web2py] Re: list reference with ondelete=set null breaking when delete parent

2015-03-10 Thread Paolo Valleri
ondelete is for reference field. At a first sight, a possible workaround would be to write your own 'ondelete' by using the _before_delete and _after_delete callbacks Paolo On Monday, March 9, 2015 at 7:09:54 PM UTC+1, Ron Chatterjee wrote: > > Wonder if he can try to make it a list and do list.

[web2py] Re: list reference with ondelete=set null breaking when delete parent

2015-03-09 Thread Ron Chatterjee
Wonder if he can try to make it a list and do list.remove? Have you tried that? On Thursday, March 20, 2014 at 3:07:47 PM UTC-4, Leonel Câmara wrote: > > I think you should have a third table anyway or searches for T-shirts of a > given colour will be quite slow. > -- Resources: - http://web2p

Re: [web2py] Re: list reference with ondelete=set null breaking when delete parent

2015-03-09 Thread Francisco Costa
Hi ANdré, did you find a way to solve this? On Thursday, 20 March 2014 22:10:33 UTC, André Kablu wrote: > > Yes just migrated to mongodb, and there really exist some issue. > > using CASCADE or SET NULL, it does not matter, web2py does not respect and > remove the reference from the referencing c

Re: [web2py] Re: list reference with ondelete=set null breaking when delete parent

2014-03-22 Thread Niphlod
you're all forgetting that: - relational database do have FK working - sqlite is not properly relational in matters of FK, unless you're working with a recent app (foreign key support was introduced by default in a recent release) and a fresh database - list:reference is not something baked in th

Re: [web2py] Re: list reference with ondelete=set null breaking when delete parent

2014-03-21 Thread PN
You're right, the update is defined on the field like you have. I have used 'NO ACTION' on a reference field with no issues. However never tried it 'SET NULL' on a List:reference. I spoke too soon. On Friday, March 21, 2014 1:21:34 PM UTC-4, André Kablu wrote: > > I think you are mistaken... >

Re: [web2py] Re: list reference with ondelete=set null breaking when delete parent

2014-03-21 Thread Kablu®
I think you are mistaken... ondelete is for use with upload and reference fields... http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor On Fri, Mar 21, 2014 at 1:54 PM, PN wrote: > Your desired behavior is that when a color is deleted it should be s

[web2py] Re: list reference with ondelete=set null breaking when delete parent

2014-03-21 Thread PN
Your desired behavior is that when a color is deleted it should be set to null in tshirts, so you need to put the ondelete attribute in the color field in the color table instead of on the colors field in the tshirt table. db.define_table('color', Field('color', 'string',

Re: [web2py] Re: list reference with ondelete=set null breaking when delete parent

2014-03-20 Thread André Kablu
Yes just migrated to mongodb, and there really exist some issue. using CASCADE or SET NULL, it does not matter, web2py does not respect and remove the reference from the referencing collection or delete the reference... Em quinta-feira, 20 de março de 2014 16h16min43s UTC-3, André Kablu esc

Re: [web2py] Re: list reference with ondelete=set null breaking when delete parent

2014-03-20 Thread Kablu®
I will migrate it later to mongodb, but wanted it to work on sqlite too for dev, and not have to create a lot of validators on each delete or update. That`s why I was wondering if web2py can handle this transparently. On Thu, Mar 20, 2014 at 4:07 PM, Leonel Câmara wrote: > I think you should h

[web2py] Re: list reference with ondelete=set null breaking when delete parent

2014-03-20 Thread Leonel Câmara
I think you should have a third table anyway or searches for T-shirts of a given colour will be quite slow. -- 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) --