I've got an odd situation here, any idea why the delete SQL for the 
`myapp_entry_tag` table is being performed twice?

>>> from myapp.models import Tag
>>> from django.db import connection
>>> from pprint import pprint
>>> Tag.objects.only('pk').get(pk=1).delete()
>>> pprint(connection.queries)
[{u'sql': u'SELECT `myapp_tag`.`id` FROM `myapp_tag` ''WHERE 
`myapp_tag`.`id` = 1 ',
  u'time': u'0.000'},
 {u'sql': u'DELETE FROM `myapp_entry_tag` WHERE `myapp_entry_tag`.`tag_id` 
IN (1)',
  u'time': u'0.000'},
 {u'sql': u'DELETE FROM `myapp_entry_tag` WHERE `myapp_entry_tag`.`tag_id` 
IN (1)',
  u'time': u'0.000'},
 {u'sql': u'DELETE FROM `myapp_tag` WHERE `id` IN (1)', u'time': u'0.000'}]

models.py:

    class Tag(models.Model):
        ...

    class EntryTag(models.Model):
        ...
        tag = models.ForeignKey(Tag)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to