Changes between Version 5 and Version 6 of ModelInheritance
- Timestamp:
- Feb 2, 2006, 3:41:22 AM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ModelInheritance
v5 v6 34 34 35 35 class ItalianRestaurant(Restaurant): 36 has_decent_gnocc i = models.BooleanField()36 has_decent_gnocchi = models.BooleanField() 37 37 }}} 38 38 … … 57 57 CREATE TABLE "myapp_italianrestaurant" ( 58 58 "id" integer NOT NULL PRIMARY KEY REFERENCES "myapp_restaurant" ("id"), 59 "has_decent_gnocc i" bool NOT NULL59 "has_decent_gnocchi" bool NOT NULL 60 60 ); 61 61 }}} … … 68 68 SELECT ... 69 69 FROM myapp_italianrestaurant as ir 70 LEFTJOIN myapp_restaurant as r70 INNER JOIN myapp_restaurant as r 71 71 ON ir.restaurant_id=r.id 72 LEFTJOIN myapp_place as p72 INNER JOIN myapp_place as p 73 73 ON r.place_id=p.id 74 74 }}} … … 107 107 p = Place(name='My House') 108 108 r = Restaurant(name='Road Kill Cafe', description='Yuck!') 109 ir = ItalianRestaurant(name= 'Luigis', description='Something', has_decent_gnocci=False)109 ir = ItalianRestaurant(name="Ristorante Miron", description="Italian's best mushrooms restaurant", has_decent_gnocchi=True) 110 110 }}} 111 111