#31474: QuerySet.Delete - inconsistent result when zero objects deleted
-------------------------------------+-------------------------------------
               Reporter:  Adi        |          Owner:  nobody
  Gabaie                             |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  Database   |        Version:  2.2
  layer (models, ORM)                |       Keywords:  querySet Delete
               Severity:  Normal     |  counter
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 The result format of the QuerySet.Delete method is a tuple: (X, Y)
 X - is the total amount of deleted objects (including foreign key deleted
 objects)
 Y - is a dictionary specifying counters of deleted objects for each
 specific model (the key is the _meta.label of the model and the value is
 counter of deleted objects of this model).

 Example: <class 'tuple'>: (2, {'my_app.FileAccess': 1, 'my_app.File': 1})

 When there are zero objects to delete in total - the result is
 inconsistent:
 - For models with foreign keys - the result will be: <class 'tuple'>: (0,
 {})
 - For "simple" models without foreign key - the result will be: <class
 'tuple'>: (0, {'my_app.BlockLibrary': 0})

 I would expect there will be no difference between the two cases: Either
 both will have the empty dictionary OR both will have dictionary with
 model-label keys and zero value.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31474>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.78dd398e027810f02e45a1aa8d02f5c9%40djangoproject.com.

Reply via email to