Personal Catalogue: Django & PostgreSQL — Chapter 2, Exercise 2 ==================================================== TASK Explain, in your own words, why a shared Item model with a generic creator field was chosen over four separate per-type models, and name the one real feature that decision makes simpler. SOLUTION A fully "correct" normalized design would give each item type its own model — a Book model with an author field, a MusicCD model with an artist field, a Movie model (covering both DVD and Blu-ray) with a director field, and so on. Every field on every model would then genuinely apply to every row of that model, with nothing left meaningless or blank. The real cost of that design shows up specifically when trying to answer the app's own central question: "do I already own this?" With four separate models, answering that means running a real query against each of the four models separately and then combining the results in Python - four queries and some merging logic, every single time a search happens. The shared Item model, with a generic creator field standing in for author/artist/director depending on the row's own item_type, avoids that entirely. A single Django ORM query - something like Item.objects.filter(title__icontains=query) - searches across every item type at once, because every item type's data already lives in the same table. THE ONE FEATURE THIS MAKES SIMPLER Search-across-everything - the app's real core "do I already own this?" feature, covered in full in Chapter 7 - becomes a single ORM query instead of four separate queries merged together. That's the concrete, specific payoff of accepting a slightly less "pure" schema: a few fields (like creator on a DVD row) are meaningless for some rows, in exchange for the app's own most important feature staying genuinely simple to implement and reason about. WHY THIS WORKS AS AN ANSWER ---------------------------- It compares the real query cost of both designs specifically for the search feature, rather than treating "shared model" as simply a stylistic preference, and names the one concrete feature (cross-type search) the choice was actually optimizing for.