Module Expr Str ImportFrom alias ClassDef bases AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr keyword Num ClassDef bases body Assign NameStore TupleLoad Str decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Return BinOpMod Str AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list decorator_list Assign NameStore Dict Str Str
N/A N/A 
Regression tests for the interaction between model inheritance and
select_related().
 django.db models Place N/A N/A models Model N/A N/A name N/A N/A models CharField max_length 50 Meta N/A N/A N/A ordering N/A name N/A __unicode__ N/A N/A self N/A N/A N/A N/A %s the place N/A self name N/A N/A Restaurant N/A Place N/A N/A serves_sushi N/A N/A models BooleanField N/A serves_steak N/A N/A models BooleanField __unicode__ N/A N/A self N/A N/A N/A N/A %s the restaurant N/A self name N/A N/A Person N/A N/A models Model N/A N/A name N/A N/A models CharField max_length 50 N/A favorite_restaurant N/A N/A models ForeignKey Restaurant __unicode__ N/A N/A self N/A N/A N/A N/A self name N/A N/A N/A __test__ N/A API_TESTS 
Regression test for #7246

>>> r1 = Restaurant.objects.create(name="Nobu", serves_sushi=True, serves_steak=False)
>>> r2 = Restaurant.objects.create(name="Craft", serves_sushi=False, serves_steak=True)
>>> p1 = Person.objects.create(name="John", favorite_restaurant=r1)
>>> p2 = Person.objects.create(name="Jane", favorite_restaurant=r2)

>>> Person.objects.order_by('name').select_related()
[<Person: Jane>, <Person: John>]

>>> jane = Person.objects.order_by('name').select_related('favorite_restaurant')[0]
>>> jane.favorite_restaurant.name
u'Craft'

