I have a model 'Account' with a OneToOne relation to another model
Tokens and then lots of
other stuff in my models

Class Account (.....

                 tokens = models.OneToOneField('TokenStore',
verbose_name=_(u'Token Store'), related_name='account')

When deleting an Account from admin gui it cascades and everything is
deleted ok -- except this Tokens instance (and I would like to delete
it also). This makes my database corrupt as I now have
a Token instance with no account (so I get an exception - object not
found whenever I try and look at an account)...

I have tried inserting a delete for this token in the pre_delete
signal for an Account (but then I get a good old infinite recursion -
since the account deletes a token that deletes its account that
deleltes its token that...) and in post_delete it seems that trying to
do instance.tokens.delete() makes a db lookup and the instance (=of
the Account) has already been deleted from db so that also goes
pooofff...

Any ideas...??

Running local on mac but deployment uses Postgres
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to