Django

Code

Changeset 2256

Show
Ignore:
Timestamp:
02/03/06 17:30:12 (3 years ago)
Author:
adrian
Message:

magic-removal: Fixed errors in m2m_multiple unit tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/tests/modeltests/m2m_multiple/models.py

    r2244 r2256  
    4343>>> a1 = Article(headline='Area man steals', pub_date=datetime(2005, 11, 27)) 
    4444>>> a1.save() 
    45 >>> a1.set_primary_categories([c2.id, c3.id]) 
    46 True 
    47 >>> a1.set_secondary_categories([c4.id]) 
     45>>> a1.primary_categories.add(c2, c3) 
     46>>> a1.secondary_categories.add(c4) 
    4847True 
    4948 
    5049>>> a2 = Article(headline='Area man runs', pub_date=datetime(2005, 11, 28)) 
    5150>>> a2.save() 
    52 >>> a2.set_primary_categories([c1.id, c2.id]) 
    53 True 
    54 >>> a2.set_secondary_categories([c4.id]) 
     51>>> a2.primary_categories.add(c1, c2) 
     52>>> a2.secondary_categories.add(c4) 
    5553True 
    5654 
    57 # The "primary_category" here comes from the "singular" parameter. If we hadn't 
    58 # specified the "singular" parameter, Django would just use "category", which 
    59 # would cause a conflict because the "primary_categories" and 
    60 # "secondary_categories" fields both relate to Category. 
    6155>>> a1.primary_categories.all() 
    6256[Crime, News] 
    6357 
    64 # Ditto for the "primary_category" here. 
    6558>>> a2.primary_categories.all() 
    6659[News, Sports] 
    6760 
    68 # Ditto for the "secondary_category" here. 
    6961>>> a1.secondary_categories.all() 
    7062[Life]