What is the difference between a Multi-table inherited model and a simple One-to-one relationship between the same two models?

后端 未结 2 2087
礼貌的吻别
礼貌的吻别 2021-02-13 04:43

What is the differences between these implementations? What does Django differently (beside inheriting Meta ordering and get_latest_by attribute) ?

2条回答
  •  借酒劲吻你
    2021-02-13 05:27

    1 - to create restaurant you need to create place, after create restaurant, after link them, 2 - then creating restaurant, new place created and linked automaticaly, 3 - you renamed parent link to place.

    Using Model Inheriting with Content Types you can list all Cafes, Restaurants, Bars, etc iterating on Place.objects.all()

提交回复
热议问题