#31258: Django admin deletes only one instance from many
-----------------------------------------+------------------------
               Reporter:  Pavel-Y        |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  contrib.admin  |        Version:  2.2
               Severity:  Normal         |       Keywords:  admin
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 This is my first bug report here, hope I don't mess things too much.

 I have this model. I have plenty of instances with the same name, same
 start_date and is_deleted=true. Also one instance with same name, same
 start_date but is_deleted=false.

 When I go to admin page, mark _all_ those where is_deleted==true and
 delete them, I am asked if I am sure I want to delete. I answer Yes and I
 am returned to the previous page, to the list of instances. However only
 one of those instances is deleted.

 I think it's a bug. I think all marked instances should be deleted.
 Django 2.2.10, python 3.6.4

 {{{
 class Festival(models.Model):
     name = models.CharField(max_length=100)
     start_date = models.DateField(null=True)
     is_deleted = models.BooleanField(default=False)

     def __str__(self):
         return self.name

     def __lt__(self, rhs):
         if self.start_date is None:
             return False
         if rhs.start_date is None:
             return True
         return (self.start_date < rhs.start_date
             or self.start_date == rhs.start_date and self.name < rhs.name)

     def __eq__(self, rhs):
         return (self.start_date == rhs.start_date
             and self.name == rhs.name
             and self.is_deleted == rhs.is_deleted)

     def __hash__(self):
         return hash((self.name, self.start_date, self.is_deleted))

 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31258>
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/050.d1f5d83907244968f574b6cb82e7ec57%40djangoproject.com.

Reply via email to