Django

Code

Changeset 3321

Show
Ignore:
Timestamp:
07/10/06 22:20:11 (2 years ago)
Author:
adrian
Message:

Small formatting change to m2m_and_m2o model unit test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/modeltests/m2m_and_m2o/models.py

    r3041 r3321  
    2929>>> g = User(username='gustav') 
    3030>>> g.save() 
     31 
    3132>>> i = Issue(num=1) 
    3233>>> i.client = r 
    33 >>> i.validate() 
    34 {} 
    3534>>> i.save() 
     35 
    3636>>> i2 = Issue(num=2) 
    3737>>> i2.client = r 
    38 >>> i2.validate() 
    39 {} 
    4038>>> i2.save() 
    4139>>> i2.cc.add(r) 
     40 
    4241>>> i3 = Issue(num=3) 
    4342>>> i3.client = g 
    44 >>> i3.validate() 
    45 {} 
    4643>>> i3.save() 
    4744>>> i3.cc.add(r) 
     45 
    4846>>> from django.db.models.query import Q 
     47 
    4948>>> Issue.objects.filter(client=r.id) 
    5049[<Issue: 1>, <Issue: 2>] 
     
    5655[<Issue: 2>, <Issue: 3>] 
    5756 
    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. 
    6059>>> Issue.objects.filter(Q(cc__id__exact=r.id) | Q(client=r.id)) 
    6160[<Issue: 1>, <Issue: 2>, <Issue: 3>]