Friday, March 16, 2012

get().delete() does not work, filter().delete() works?

Hi, I have a function that accepts a pk and deletes an object:

Item.objects.filter(pk=pk).delete()

If I change it to:

Item.objects.get(pk=pk).delete()

it no longer works, without any errors. I tried it using exactly the
same object. I looked at django docs for deletion, the only difference
they mention is that with .filter(), it will also do bulk deletion.

What is the reason for this behaviour? Thanks!

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate