5

Working with Models

Storing data in a database is a common practice in most web applications. In a Django project, it involves working with Django models. In this chapter, we will create a database model (for example, a movie) and Django will turn this model into a database table for us. We will also explore a powerful built-in admin interface that provides a visual way of managing all aspects of a Django project, such as users and making changes to model data.

In this chapter, we will cover the following topics:

  • Creating our first model
  • Installing Pillow
  • Managing migrations
  • Accessing the Django admin interface
  • Configuring image upload
  • Serving stored images
  • Adding a movie model to admin

Technical requirements

In this chapter, we will be ...

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.