#9519: QuerySet.delete() should operate with respect to previous query 
operations
------------------------------------------+---------------------------------
 Reporter:  Tarken                        |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.0       
 Keywords:  database, queryset, delete    |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 Example:

 {{{
 #!python
 from django.db import models

 class MyModel(models.Model):
     my_id = models.IntegerField(primary_key=True)
     col1 = models.IntegerField()
     col2 = models.CharField(max_length=1)
     col3 = models.TextField()

     class Meta:
         unique_together = ('my_id', 'col1', 'col2') # "Fake" a multi-part
 primary key

 # This works for creating all 3, as force_insert is used in create()
 MyModel.objects.create(my_id=1, col1=5, col2='a', col3='foo')
 MyModel.objects.create(my_id=1, col1=5, col2='b', col3='bar')
 MyModel.objects.create(my_id=1, col1=10, col2='a', col3='baz')

 MyModel.objects.filter(my_id=1, col1=5).delete()
 }}}

 This deletes all of the objects created above, since deletion is done only
 based on model._meta.pk. This is fine, except when you are using multi-
 part primary keys and emulating that pkey as suggested in #373.

 In my opinion, the delete operation should be executed with respect to the
 filter(), extra(), etc which were previously performed on the QuerySet.

 This is, in a way, a part of ticket #373, but I believe it can be viewed
 as a completely separate issue. In some cases, you do want to delete based
 on columns other than the primary key. Why build a list of all of those
 primary keys when you've already specified all of the qualifiers in a
 filter()?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9519>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to