Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
What is Model? | Models
Django: First Dive
course content

Course Content

Django: First Dive

Django: First Dive

1. Get Started
2. Write the First Page
3. Models
4. Working with Database
5. Templates
6. Request Handling

bookWhat is Model?

Model is a class that represents a table from a database. Attributes of a model class are attributes of a table in the database (columns or fields).

Instances of this class are records (data) in the database.

Consider the table below for a better understanding:

Look at the attributes of this table on the ER diagram.

The ER diagram represents the table structure. We can build this structure in the Django project using the Django ORM.

Note

Object Relation Mapping (ORM) is an interface for database manipulation.

The code of this table structure should look like this:

Where:

  • Product is a table name.
  • name, price, and quantity are attributes of the Product table.
  • models is a package with Django ORM tools.

Note

The id field is created automatically in Django. We will describe this later.

1. What is a Model?
2. What is an instance of the Model class?
3. What is Object Relation Mapping (ORM)?
What is a Model?

What is a Model?

Select the correct answer

What is an instance of the Model class?

What is an instance of the Model class?

Select the correct answer

What is Object Relation Mapping (ORM)?

What is Object Relation Mapping (ORM)?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 1
We're sorry to hear that something went wrong. What happened?
some-alt