27.1 Introduction
When discussing Model-View-Controller (MVC) architecture (which Django is only very loosely based on, as we saw in Chapter 12: The Big Picture), developers advocate for fat models, thin controllers, and even thinner views. Django follows a similar principle: logic surrounding data should be placed in models as much as possible, while the controller should handle only logic related to rendering webpages. The templates should be limited entirely to displaying content.
At the moment, some of our templates are overly complicated. The way we compute how to display related blog posts is long and complicated. What’s more, our templates are in violation of Don’t Repeat Yourself (DRY) principles in multiple places: most of our forms ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access