Re: Why on_delete attribute is not available on GenericForeignKey?

2012-03-07 Thread akaariai
On Mar 7, 11:40 pm, Marc Aymerich wrote: > On Wed, Mar 7, 2012 at 9:13 PM, akaariai wrote: > > I believe the reason is efficiency. If there were an on_delete > > argument for GFKs every object deletion of any class would need to do > > a query to check if

Re: Why on_delete attribute is not available on GenericForeignKey?

2012-03-07 Thread Marc Aymerich
On Wed, Mar 7, 2012 at 9:13 PM, akaariai wrote: > I believe the reason is efficiency. If there were an on_delete > argument for GFKs every object deletion of any class would need to do > a query to check if there happens to be any GFK related objects. In > addition, Django

Re: Why on_delete attribute is not available on GenericForeignKey?

2012-03-07 Thread akaariai
I believe the reason is efficiency. If there were an on_delete argument for GFKs every object deletion of any class would need to do a query to check if there happens to be any GFK related objects. In addition, Django can't guarantee foreign key consistency. In case of concurrent transactions it

Why on_delete attribute is not available on GenericForeignKey?

2012-03-07 Thread Marc Aymerich
The django docs says: Unlike ForeignKey, GenericForeignKey does not accept an on_delete argument to customize this behavior; if desired, you can avoid the cascade-deletion simply by not using GenericRelation, and alternate behavior can be provided via the pre_delete signal. Does anyone knows why?