3.6.2 Database Interaction via Managers
Django attaches an object called a manager to every model class. The manager helps interaction with the database in complicated ways: it is a key part of Django’s ORM (which is hinted at by the db
in the path below) and is the most common way Django developers will interact with data in the database. Effectively, it is one of the most powerful tools inherited through models.Model
and one with which we will be very familiar by the end of the book.
By default, Django automatically generates a manager for each model and assigns it to the objects
attribute. As shown in Example 3.45, we can use the Python type()
built-in to see what the object is.
Get Django Unleashed 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.