Ticket #6915: 6915.regressiontest.diff
File 6915.regressiontest.diff, 1.5 KB (added by , 16 years ago) |
---|
-
tests/regressiontests/queries/models.py
134 134 def __unicode__(self): 135 135 return self.data 136 136 137 class Bug6915(models.Model): 138 name = models.CharField(max_length=10) 137 139 140 deleted = [] 141 def delete(self): 142 super(Bug6915, self).delete() 143 self.__class__.deleted.append(self) 144 145 def __unicode__(self): 146 return u"%s" % self.name 147 138 148 __test__ = {'API_TESTS':""" 139 149 >>> t1 = Tag(name='t1') 140 150 >>> t1.save() … … 600 610 >>> Author.objects.filter(Q(extra__note=n1)|Q(item__note=n3)).filter(id=a1.id) 601 611 [<Author: a1>] 602 612 613 Bug #6915 614 Make shure custom Model.delete() methods are called. 615 616 >>> a = Bug6915(name="A") 617 >>> a.save() 618 >>> Bug6915.objects.all().delete() 619 >>> Bug6915.objects.all() 620 [] 621 >>> Bug6915.deleted 622 [<Bug6915: A>] 623 >>> a = Bug6915(name="A") 624 >>> a.save() 625 >>> b = Bug6915(name="B") 626 >>> b.save() 627 >>> Bug6915.objects.filter(name='B').delete() 628 >>> Bug6915.objects.all() 629 [<Bug6915: A>] 630 >>> Bug6915.deleted 631 [<Bug6915: A>, <Bug6915: B>] 632 >>> c=Bug6915(name="C") 633 >>> c.save() 634 >>> Bug6915.objects.order_by('name')[1:].delete() 635 >>> Bug6915.deleted 636 [<Bug6915: A>, <Bug6915: B>, <Bug6915: C>] 637 603 638 Bug #6981 604 639 >>> Tag.objects.select_related('parent').order_by('name') 605 640 [<Tag: t1>, <Tag: t2>, <Tag: t3>, <Tag: t4>, <Tag: t5>]