Changeset 3321
- Timestamp:
- 07/10/06 22:20:11 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/tests/modeltests/m2m_and_m2o/models.py
r3041 r3321 29 29 >>> g = User(username='gustav') 30 30 >>> g.save() 31 31 32 >>> i = Issue(num=1) 32 33 >>> i.client = r 33 >>> i.validate()34 {}35 34 >>> i.save() 35 36 36 >>> i2 = Issue(num=2) 37 37 >>> i2.client = r 38 >>> i2.validate()39 {}40 38 >>> i2.save() 41 39 >>> i2.cc.add(r) 40 42 41 >>> i3 = Issue(num=3) 43 42 >>> i3.client = g 44 >>> i3.validate()45 {}46 43 >>> i3.save() 47 44 >>> i3.cc.add(r) 45 48 46 >>> from django.db.models.query import Q 47 49 48 >>> Issue.objects.filter(client=r.id) 50 49 [<Issue: 1>, <Issue: 2>] … … 56 55 [<Issue: 2>, <Issue: 3>] 57 56 58 # Queries that combine results from the m2m and the m2o relationship.59 # 3 ways of saying the same thing:57 # These queries combine results from the m2m and the m2o relationships. 58 # They're three ways of saying the same thing. 60 59 >>> Issue.objects.filter(Q(cc__id__exact=r.id) | Q(client=r.id)) 61 60 [<Issue: 1>, <Issue: 2>, <Issue: 3>]
