Django

Code

Show
Ignore:
Timestamp:
05/29/08 07:17:03 (6 months ago)
Author:
russellm
Message:

Fixed #7173 -- Corrected the caching of objects in reverse OneToOne? relationships. Thanks, Travis Terry.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/one_to_one_regress/models.py

    r5876 r7561  
    1515    def __unicode__(self): 
    1616        return u"%s the restaurant" % self.place.name 
     17 
     18class Bar(models.Model): 
     19    place = models.OneToOneField(Place) 
     20    serves_cocktails = models.BooleanField() 
     21 
     22    def __unicode__(self): 
     23        return u"%s the bar" % self.place.name 
    1724 
    1825class Favorites(models.Model): 
     
    3542>>> f.restaurants.all() 
    3643[<Restaurant: Demon Dogs the restaurant>] 
     44 
     45# Regression test for #7173: Check that the name of the cache for the  
     46# reverse object is correct. 
     47>>> b = Bar(place=p1, serves_cocktails=False) 
     48>>> b.save() 
     49>>> p1.restaurant 
     50<Restaurant: Demon Dogs the restaurant> 
     51>>> p1.bar 
     52<Bar: Demon Dogs the bar> 
    3753"""}