6

Collecting and Displaying Data from the Database

In the previous chapters, movie information was gathered using dummy data implemented within a Python list. While this approach served as a good initial attempt to display movie information, it doesn’t scale well. If we want to add a new movie or edit an existing one, we will need to modify our Python code. This chapter focuses on the process of refactoring both the movies and individual movie pages to retrieve and present information directly from the database. With this approach, if we need to add new movies or modify existing ones, we can simply access the admin panel without the need to modify the Python code. Additionally, we will implement a new movie search functionality.

In this chapter, ...

Get Django 5 for the Impatient - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.