The Ins and Outs of Model Inheritance
summary
Covers concrete claims and tradeoffs: Django supports abstract, multiple table inheritance causes up to n queries per record and proxy models with custom managers, plus alternatives like generic foreign keys and Postgres JSONField. Recommends composition over inheritance, shows a shopping cart and product examples, links to Django typed models and downcasting packages, and warns that JSON field stores unstructured data but is hard to query while proxy models use one table and change behavior via managers.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:16Composition vs Inheritance
- 2:52Composition in Django
- 3:38Abstract Models
- 4:42EOD Diagram
- 5:11Use Cases
- 7:00MultiTable Inheritance
- 14:08Down Casting
- 16:21Generic Foreign Keys
- 19:39Unstructured Data
- 22:15Explicit
- 23:25Outro
related talks
42mDjango ORM: The MTI vs STI Showdown
24mOne database table, one model, many behaviours: Proxy model
30mThe Wizardry of Metaprogramming
21mCustom Model Managers and QuerySets: Graduating from Django Beginner to ORM Master
21mDjango and PostgreSQL: An Even-Closer Union
16mBig O No: Django ORM runtime complexity and how to avoid it using LATERAL JOINS
19mData internationalization in Django
24mEvolving Django: What We Learned
