Django

Code

Changeset 648

Show
Ignore:
Timestamp:
09/19/05 20:12:24 (3 years ago)
Author:
adrian
Message:

Added unit test to one_to_one model that confirms #527

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/testapp/models/one_to_one.py

    r549 r648  
    2323    def __repr__(self): 
    2424        return "%s the restaurant" % self.get_place().name 
     25 
     26class Waiter(meta.Model): 
     27    restaurant = meta.ForeignKey(Restaurant) 
     28    name = meta.CharField(maxlength=50) 
     29 
     30    def __repr__(self): 
     31        return "%s the waiter at %s" % (self.name, self.get_restaurant()) 
    2532 
    2633API_TESTS = """ 
     
    6269>>> restaurants.get_object(pk=1) 
    6370Demon Dogs the restaurant 
     71 
     72# Add a Waiter to the Restaurant. 
     73>>> w = r.add_waiter(name='Joe') 
     74>>> w.save() 
     75>>> w 
     76Joe the waiter at Demon Dogs the restaurant 
    6477"""