Are you saying you want to do ON DELETE SET NULL (i.e., set the value of the 
reference field to NULL when the referenced object is deleted)?
 
web2py Fields take an ondelete argument that defaults to CASCADE (which will 
delete referencing records when the referenced object is deleted). I suppose 
you could try ondelete='SET NULL' and see if it works.
 
See http://web2py.com/book/default/chapter/06#Record-Representation (explains 
all the arguments to Field).
 
Anthony

On Wednesday, August 24, 2011 4:53:18 AM UTC-4, TomPliss wrote:

> Hey guys (yeah, i'm still here), 
>
> I'd like to know what is the best way to remove a DB reference when 
> the referenced object is removed. 
> Is it possible directly in the db.py ? 
> Is it possible to do it without modifying every form.accept including 
> a reference in the form ? 
>
>
>
> PS: talking about removing the reference, not the referencing object ;)

Reply via email to