Django models operate by default on relational database systems (RDBMS) and support relationships.

Django Follows the 3 model Relationships:

1- One-To-One Relationship
2- One-To-Many Relationship
3- Many-To-Many Relatiosnship

One-To-One Relationship (OneToOneField)

One record in a table is associated with one and only one record in another table.

- Car company can have only one CEO.
- CEO can work only one Car company.

Django Model Relations — 4

Before learning about this, you may want to take a look at one-to-one, one -to-many and many-to-many relationships.

POLYMORPHIC ONE-TO-MANY RELATIONSHIP

- Sony can be sound system of many car models
- Pioneer can be sound system of many car models
- Car model can have only one sound system (Sony or Pioneer)

Django Model Relations — 3

Before learning about this, you may want to take a look at one-to-one and one -to-many relationships.

Many-To-Many Relationship

Multiple records in a table are associated with multiple records in another table.

- Many car models can run on same fuel type.
- Car model can run on diffrent fuel types.

|--------|--------|
|CarModel|FuelType|
|--------|--------|
|…

Django Model Relations — 2

Before learning about this, you may want to take a look at one-to-one relationship.

One-To-Many Relationship

One record in a table can be associated with one or more records in another table.

- Car company can have one or more car model.
- Car model can only belong to one car company.

Django Model Relations — 1

One record in a table is associated with one and only one record in another table.

- Car company can have only one CEO.
- CEO can work only one Car company.

|----------|--------------|
|CarCompany| CEO |
|----------|--------------|
|Mercedes | Adam Smith…

Build a Product Review Backend with DRF — Part 10

When using JWT authentication, the client side stores the token and attaches it to every request. So, the first thing to do when logging out, is just delete the token you stored on local storage. In that case the client won’t have a token to put in the request, thus…

Build a Product Review Backend with DRF — Part 9

We recently wrote an article about JWT Authentication and User Registration. We’ll add change password and update profile functionality with this article.

For change password open auth/serializers.py and type the following lines of code:

Password fields must be same. We can validate these fields with serializers validate() method. We…

Build a Product Review Backend with DRF — Part 8

We recently wrote an article about JWT Authentication. Now we can create new app for user management. For creating new app run startapp command.

python manage.py startapp auth

Actually, we have created endpoints for login before. At this stage we will move them to the auth application. For this;

Create…

Build a Product Review Backend with DRF — Part 7

What is JWT?

JSON Web Token (JWT) is an open standard that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWT used to create access tokens for an application. …

Yunus Emre Cevik

?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store