Changes between Version 5 and Version 6 of ModelInheritance


Ignore:
Timestamp:
Feb 2, 2006, 3:41:22 AM (18 years ago)
Author:
C8E
Comment:

Fixed join intention and correct italianization. And, yes, a little subliminal advertise, too ;)

Legend:

Unmodified
Added
Removed
Modified
  • ModelInheritance

    v5 v6  
    3434
    3535class ItalianRestaurant(Restaurant):
    36     has_decent_gnocci = models.BooleanField()
     36    has_decent_gnocchi = models.BooleanField()
    3737}}}
    3838
     
    5757CREATE TABLE "myapp_italianrestaurant" (
    5858    "id" integer NOT NULL PRIMARY KEY REFERENCES "myapp_restaurant" ("id"),
    59     "has_decent_gnocci" bool NOT NULL
     59    "has_decent_gnocchi" bool NOT NULL
    6060);
    6161}}}
     
    6868SELECT ...
    6969FROM myapp_italianrestaurant as ir
    70 LEFT JOIN myapp_restaurant as r
     70INNER JOIN myapp_restaurant as r
    7171ON ir.restaurant_id=r.id
    72 LEFT JOIN myapp_place as p
     72INNER JOIN myapp_place as p
    7373ON r.place_id=p.id
    7474}}}
     
    107107p = Place(name='My House')
    108108r = Restaurant(name='Road Kill Cafe', description='Yuck!')
    109 ir = ItalianRestaurant(name='Luigis', description='Something', has_decent_gnocci=False)
     109ir = ItalianRestaurant(name="Ristorante Miron", description="Italian's best mushrooms restaurant", has_decent_gnocchi=True)
    110110}}}
    111111
Back to Top