Another problem! I'm using Django 1.0.2, Python 2.5.2, on Ubuntu 8.10. I have a structure of keys and keyrings arranged in a tree of arbitrary depth which I decided to implement as a bunch of models: RootKeyRing, RootKey, SubKeyRing, SubKey (rather than as XML like maybe I should have done) because I wanted to use the Admin interface with it and not manually edit XML or write a special admin.
A SubKey has a ForeignKey which is a SubKeyRing to which it must belong, and a OneToOneField with attributes blank=True and null=True which is a SubKeyRing it may optionally point to. That all works great. The problem comes when I go to delete a SubKeyRing. The desired behaviour is for all of the SubKeyRing's SubKeys to die, and it does that (the case of killing any SubKeyRings that belong to the SubKeys is handled by using the pre_delete signal, and not the problem right now). However, it has an unpleasant side effect - it also kills its parent key, which is pointing to it with the OneToOneField, even though that field is allowed to be none. I understand it is doing this because OneToOneField is based off of ForeignKey - but what I would like to have happen is to set the OneToOneField to None instead of deleting the parent key. Is there some way to suppress the delete cascade behaviour for a relation? I tried connecting a function to the pre_delete signal for the SubKeyRing and just setting the parent_key to None, but it tries to delete the parent key anyway and raises an AttributeError, so that's not going to cut it. Any ideas? I would rather suppress the delete cascade behaviour than restructure my models because aside from this one problem, I really like the structure I'm using and don't want to refactor it. Thanks, Stephen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" 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-users?hl=en -~----------~----~----~----~------~----~------~--~---

