On Wed, Feb 3, 2010 at 3:21 PM, kanu <[email protected]> wrote: > Hi, > > My Ticket http://code.djangoproject.com/ticket/12760 Titled : "related > models with Foreignkey.null=True must not get deleted on delete of > their relation" was marked as dublicate today. > > I don't aggree that this is a dublicate. i filed this as a bug not a > feature request. >
The fact that you do not like the existing behavior does not make it a bug. There have been fairly extensive discussions on this list and in tickets on this subject; I'm reasonably certain from those that the existing behavior is in fact intentional. Many people don't like it. Supporting other behaviors is a feature request, already tracked by another ticket. I really think that it was intendet to not delete those relations. > e.g. the comments in CollectedObjects.add say : > # Nullable relationships can be ignored -- they are nulled out before > # deleting, and therefore do not affect the order in which objects > # have to be deleted. > > Even if it is not a bug the code appears a little confusing. > Why is a relation updated and afterwards deleted ? > >From my reading of that comment, it doesn't imply the objects won't be deleted. The code here appears to be concerned with generating the list of objects to be deleted in the appropriate order, and these don't affect the order. That's why they can be ignored here. I'd guess the nulling and then deleting in the "right" order is to enable deletions that would otherwise trigger integrity errors on some DBs, but I don't know enough about this code to say for sure. If you read through the related tickets I think you'll find suggestions for how to accomplish what you are looking for without actually requiring that it be implemented in the base. Karen -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
