Introduction to the Django one-to-many relationships In a one-to-many relationship, a row in a table is associated with one or more rows in another table. For example, a department may have one or more employees and each employee belongs to one department. The relationship between departments and employees is aContinue Reading

Introduction to the Django One-To-One relationship The one-to-one relationship defines a link between two tables, where each row in a table appears once in another table. For example, each employee has a contact and each contact belongs to one employee. So the relationship between employees and contacts is a one-to-oneContinue Reading

Introduction to Django ORM ORM stands for object-relational mapping. ORM is a technique that allows you to manipulate data in a relational database using object-oriented programming. Django ORM allows you to use the same Python API to interact with various relational databases including PostgreSQL, MySQL, Oracle, and SQLite. Django ORMContinue Reading

A user profile consists of settings and information associated with a user. In this tutorial, you’ll learn how to allow users to update their profiles in Django applications. Installing the pillow package Since we’ll deal with images, we need to install the pillow package by using the following pip command: pip install PillowCode language:Continue Reading

Introduction to the password reset in Django The following diagram illustrates the flow that allows a user to reset the password using an email address: First, the user clicks the Reset Password link on the login form: Django displays a form that allows the user to enter an email addressContinue Reading

The Django FormView class allows you to create a view that displays a form. We’ll use the FormView class to create a registration form for the Todo App. Creating a signup form Create form.spy file in the users app and define the RegisterForm class as follows: from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User class RegisterForm(UserCreationForm): emailContinue Reading

Django’s LoginView allows you to display the login form and process the login action. We’ll use the LoginView class to create a login page for the Todo App. Creating & configuring users app for the todo project The users application will have the following functionalities: In this tutorial, we’ll focus on the Login / Logout functions. First,Continue Reading

Create a Django DeleteView class The Django DeleteView class allows you to define a class-based view that displays a confirmation page and deletes an existing object. If the HTTP request method is GET, the DeleteView view will display the confirmation page. However, if the request is POST, the DeleteView view will delete the object. To use the DeleteView class, you defineContinue Reading

Defining the UpdateView class The UpdateView class allows you to create a class-based view that: The form is generated automatically from the object’s model unless you explicitly specify a form class. To demonstrate the Django UpdateView class, we’ll create a view that edits a task of the Todo App. To do that we modify the views.py of the todo appContinue Reading

Defining the CreateView class The CreateView class allows you to create a class-based view that displays a form for creating an object, redisplaying the form with validation errors, and saving the object into the database. To use the CreateView class, you define a class that inherits from it and add some attributes and methods. For example,Continue Reading