Ticket #13562: 13562_test_only.diff

File 13562_test_only.diff, 1.1 KB (added by Aymeric Augustin, 13 years ago)
  • tests/modeltests/one_to_one/tests.py

     
    117117        mm = MultiModel(link1=self.p2, link2=o1, name="x1")
    118118        self.assertRaises(IntegrityError, mm.save)
    119119        transaction.savepoint_rollback(sid)
     120
     121    def test_values(self):
     122        places = Place.objects.filter(pk=1).values('name', 'restaurant__serves_hot_dogs')
     123        self.assertTrue(places[0]['restaurant__serves_hot_dogs'])
  • tests/modeltests/one_to_one/models.py

     
    1616        return u"%s the place" % self.name
    1717
    1818class Restaurant(models.Model):
    19     place = models.OneToOneField(Place, primary_key=True)
     19    place = models.OneToOneField(Place, primary_key=True, related_name='restaurant')
    2020    serves_hot_dogs = models.BooleanField()
    2121    serves_pizza = models.BooleanField()
    2222
Back to Top