~ubuntu-branches/ubuntu/natty/python-django/natty-security

« back to all changes in this revision

Viewing changes to tests/regressiontests/model_inheritance_select_related/models.py

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2011-02-17 13:34:07 UTC
  • mfrom: (1.1.13 upstream) (4.4.12 sid)
  • Revision ID: james.westby@ubuntu.com-20110217133407-rwr88elhhq6j7ba0
Tags: 1.2.5-1ubuntu1
* Merge from Debian for security fixes (LP: #719031). Remaining changes:
  - debian/control: don't Build-Depends on locales-all, which doesn't exist
    in natty
* Drop the following patches, now included upstream:
  - debian/patches/07_security_admin_infoleak.diff
  - debian/patches/08_security_pasword_reset_dos.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
    def __unicode__(self):
29
29
        return self.name
30
 
 
31
 
__test__ = {'API_TESTS':"""
32
 
Regression test for #7246
33
 
 
34
 
>>> r1 = Restaurant.objects.create(name="Nobu", serves_sushi=True, serves_steak=False)
35
 
>>> r2 = Restaurant.objects.create(name="Craft", serves_sushi=False, serves_steak=True)
36
 
>>> p1 = Person.objects.create(name="John", favorite_restaurant=r1)
37
 
>>> p2 = Person.objects.create(name="Jane", favorite_restaurant=r2)
38
 
 
39
 
>>> Person.objects.order_by('name').select_related()
40
 
[<Person: Jane>, <Person: John>]
41
 
 
42
 
>>> jane = Person.objects.order_by('name').select_related('favorite_restaurant')[0]
43
 
>>> jane.favorite_restaurant.name
44
 
u'Craft'
45
 
 
46
 
"""}
47