Django

Code

Changeset 3156

Show
Ignore:
Timestamp:
06/19/06 15:19:01 (2 years ago)
Author:
adrian
Message:

Fixed some small typos in generic_relations model tests

Files:

Legend:

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

    r3134 r3156  
    6565 
    6666# Objects with declared GenericRelations can be tagged directly -- the API 
    67 # mimics the many-to-many API 
     67# mimics the many-to-many API. 
    6868>>> lion.tags.create(tag="yellow") 
    6969<TaggedItem: yellow> 
     
    8080[<TaggedItem: fatty>, <TaggedItem: salty>] 
    8181 
    82 # You can easily access the content object like a foreign key 
     82# You can easily access the content object like a foreign key. 
    8383>>> t = TaggedItem.objects.get(tag="salty") 
    8484>>> t.content_object 
     
    8686 
    8787# Recall that the Mineral class doesn't have an explicit GenericRelation 
    88 # defined. That's OK since you can create TaggedItems explicitally. 
     88# defined. That's OK, because you can create TaggedItems explicitly. 
    8989>>> tag1 = TaggedItem(content_object=quartz, tag="shiny") 
    9090>>> tag2 = TaggedItem(content_object=quartz, tag="clearish") 
     
    9292>>> tag2.save() 
    9393 
    94 # However, not having the convience takes a small toll when it comes 
    95 # to do lookups 
     94# However, excluding GenericRelations means your lookups have to be a bit more 
     95# explicit. 
    9696>>> from django.contrib.contenttypes.models import ContentType 
    9797>>> ctype = ContentType.objects.get_for_model(quartz) 
     
    9999[<TaggedItem: clearish>, <TaggedItem: shiny>] 
    100100 
    101 # You can set a generic foreign key in the way you'd expect 
     101# You can set a generic foreign key in the way you'd expect. 
    102102>>> tag1.content_object = platypus 
    103103>>> tag1.save()