Sure okay, I'll whittle my project down to the bare bones, investigate it further, and if I manage to get a simple project that reproduces it I'll let you know. Cheers!
Oh, and it's Django 1.5.1 I'm running. On Friday, 24 May 2013 11:14:03 UTC+1, akaariai wrote: > > On 22 touko, 18:57, Michael <[email protected]> wrote: > > 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) > > The answer is: this should not happen, and I wasn't able to reproduce > this using Django master. > > What version of Django is this? Could it be that you have some custom > code running (signal handlers for example)? Can you produce a small > self-contained Django project where this happens? > > - Anssi > -- 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.

