On 22 touko, 18:57, Michael <mich...@d3i.com> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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