Introduction

Completed

Although it's possible to create applications that interact with a relational database directly, this direct interaction can lead to code that's duplicated and not secure. This problem led to the introduction of object-relational mappers (ORMs), which separate database calls from objects.

As a developer, you can use ORMs to design objects that represent your data. ORMs can also manage database operations for you.

Django has a built-in ORM, which is a core component of the framework. In this module, we'll explore the Django ORM, how to create model objects, and how to interact with the database through the ORM.

In this module, you'll learn:

  • The purpose of an ORM.
  • How to set up and activate the Django SQLite database.
  • How to create and activate Django models.
  • Why the __str__ method is an important addition in classes.
  • How to create and query data in your SQLite database.

Prerequisites: