Skip to content

Commit

Permalink
Small formatting change to m2m_and_m2o model unit test
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3321 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Jul 11, 2006
1 parent 1805bbb commit 79b7fc1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/modeltests/m2m_and_m2o/models.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,24 +28,23 @@ class Meta:
>>> r.save() >>> r.save()
>>> g = User(username='gustav') >>> g = User(username='gustav')
>>> g.save() >>> g.save()
>>> i = Issue(num=1) >>> i = Issue(num=1)
>>> i.client = r >>> i.client = r
>>> i.validate()
{}
>>> i.save() >>> i.save()
>>> i2 = Issue(num=2) >>> i2 = Issue(num=2)
>>> i2.client = r >>> i2.client = r
>>> i2.validate()
{}
>>> i2.save() >>> i2.save()
>>> i2.cc.add(r) >>> i2.cc.add(r)
>>> i3 = Issue(num=3) >>> i3 = Issue(num=3)
>>> i3.client = g >>> i3.client = g
>>> i3.validate()
{}
>>> i3.save() >>> i3.save()
>>> i3.cc.add(r) >>> i3.cc.add(r)
>>> from django.db.models.query import Q >>> from django.db.models.query import Q
>>> Issue.objects.filter(client=r.id) >>> Issue.objects.filter(client=r.id)
[<Issue: 1>, <Issue: 2>] [<Issue: 1>, <Issue: 2>]
>>> Issue.objects.filter(client=g.id) >>> Issue.objects.filter(client=g.id)
Expand All @@ -55,8 +54,8 @@ class Meta:
>>> Issue.objects.filter(cc__id__exact=r.id) >>> Issue.objects.filter(cc__id__exact=r.id)
[<Issue: 2>, <Issue: 3>] [<Issue: 2>, <Issue: 3>]
# Queries that combine results from the m2m and the m2o relationship. # These queries combine results from the m2m and the m2o relationships.
# 3 ways of saying the same thing: # They're three ways of saying the same thing.
>>> Issue.objects.filter(Q(cc__id__exact=r.id) | Q(client=r.id)) >>> Issue.objects.filter(Q(cc__id__exact=r.id) | Q(client=r.id))
[<Issue: 1>, <Issue: 2>, <Issue: 3>] [<Issue: 1>, <Issue: 2>, <Issue: 3>]
>>> Issue.objects.filter(cc__id__exact=r.id) | Issue.objects.filter(client=r.id) >>> Issue.objects.filter(cc__id__exact=r.id) | Issue.objects.filter(client=r.id)
Expand Down

0 comments on commit 79b7fc1

Please sign in to comment.