Django shows too many warnings when deleting an object

Posted by valya on Stack Overflow See other posts from Stack Overflow or by valya
Published on 2010-04-27T15:05:04Z Indexed on 2010/04/28 21:17 UTC
Read the original article Hit count: 428

Hello!

I have two models:

class Account(models.Model):
    main_request = models.ForeignKey('JournalistRequest', related_name='main_request')
    key = models.CharField(_('Key'), max_length=100)

class JournalistRequest(models.Model):
    account = models.ForeignKey(Account, blank=True, null=True)

When I try to delete a JournalistRequest, It shows warning with a lot of nesting, like

Are you sure you want to delete the selected ?????? ??? objects? All of the following objects and their related items will be deleted:

   Journalist Request: some request
        Account: some account
            Journalist Request: some request
                Account: some account
                    Journalist Request: some request
                        Account: some account
                            Journalist Request: some request
                                Account: some account
                                    Journalist Request: some request

All accounts are the same one (ids are same), and all requests are the same one, so I think it becaues of a recursion. But I have no idea how to solve this problem in Django 1.1.1! Can you help me?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models