Django

Code

Show
Ignore:
Timestamp:
04/27/08 23:29:06 (9 months ago)
Author:
mtredinnick
Message:

Fixed #7096 -- The simplifications in [7461] weren't complete. They broke
multi-component exclude() calls. Fixed that.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/queries/models.py

    r7490 r7493  
    659659>>> Item.objects.values('note__note').order_by('queries_note.note', 'id') 
    660660[{'note__note': u'n2'}, {'note__note': u'n3'}, {'note__note': u'n3'}, {'note__note': u'n3'}] 
     661 
     662Bug #7096 -- Make sure exclude() with multiple conditions continues to work. 
     663>>> Tag.objects.filter(parent=t1, name='t3').order_by('name') 
     664[<Tag: t3>] 
     665>>> Tag.objects.exclude(parent=t1, name='t3').order_by('name') 
     666[<Tag: t1>, <Tag: t2>, <Tag: t4>, <Tag: t5>] 
     667>>> Item.objects.exclude(tags__name='t1', name='one').order_by('name').distinct() 
     668[<Item: four>, <Item: three>, <Item: two>] 
     669>>> Item.objects.filter(name__in=['three', 'four']).exclude(tags__name='t1').order_by('name') 
     670[<Item: four>, <Item: three>] 
     671 
     672More twisted cases, involving nested negations. 
     673>>> Item.objects.exclude(~Q(tags__name='t1', name='one')) 
     674[<Item: one>] 
     675>>> Item.objects.filter(~Q(tags__name='t1', name='one'), name='two') 
     676[<Item: two>] 
     677>>> Item.objects.exclude(~Q(tags__name='t1', name='one'), name='two') 
     678[<Item: four>, <Item: one>, <Item: three>] 
     679 
    661680"""} 
    662681