
Taranjit Singh guides you from the basics to advanced concepts in Django, revealing behind the scenes and best practices to build robust, scalable web applications.
Discover Django, a high level Python web framework that enables rapid development with batteries included features like authentication, an object-relational mapper, and an admin interface to build websites quickly.
Watch video before coding along to learn Django, Python web framework, then code on your own, use video controls to adjust speed, and Udemy Q&A for help within 48 hours.
Download and install Python from python.org, add Python to path, and verify installation with Python and pip in the command prompt; next, install Visual Studio Code Editor and Django.
Install Django using the official Django documentation and platform-specific commands for Windows, Linux, or Mac, verify with django-admin, and install Visual Studio Code to follow this course.
Install django and vscode, create a blog project with start project, and explore core files like manage.py, settings.py, and urls.py to learn django's site structure.
Learn how to run a Django development server using manage.py with the runserver command, access the site on port 8000 by default, and change to a custom port like 1313.
Learn how a Django project uses apps to modularize features like engine, music player, and air conditioning, enabling separation of logic and reuse across an e-commerce shop and blog.
Create your first django app with manage.py startapp, name it post, and explore its files, including migrations, admin, models, and views, while outlining urls and the first view.
Explore how urls and views power a Django app by mapping urls to views in urls.py, handling requests, querying the database, and returning responses.
Create a function based Django view that returns hello world, and map it to a URL using path and include across project and app urls.
Explore how Django routes requests through the root url conf to the app-specific urls.py, using include to delegate URL patterns and handle HTTP requests with views.
Send html as a response in Django by building html from a dummy posts list, looping with an f-string, and serving at /home on port 8000.
Explore how to implement dynamic URLs in Django by mapping a changing URL segment to a view, using URL parameters like page name or post id to fetch content.
Create your dynamic url to display a post by capturing an integer id with the int path converter, wiring the url pattern to a view and handling the http request.
Implement dynamic routing to show a single post by matching the URL id with post data, then render a linked post title that opens the dynamic post page.
Learn how Django's HTTP response class and its subclasses, such as HTTP response not found and redirect, use a valid_id variable to show post or return post not available.
Learn to redirect users in Django using the HTTP response redirect class, with a dynamic id from the URL, redirecting to Google.com or the post view.
Learn how to replace hardcoded redirects with Django's reverse function and named URLs for dynamic, maintainable redirects. Use reverse with URL parameters via args to keep redirects as routes change.
Master how to separate front-end logic from Django views by using per-page templates for home, static files, and the Django template language to manage HTML, CSS, and JavaScript.
Create and render home.html in Django by placing it in posts/templates and rendering in the home view with render; also register the posts app in settings installed_apps.
Learn how Django template settings determine where templates live, enable app_dirs, and organize templates in app-named folders to prevent conflicts when rendering home.html across multiple apps.
Learn to render dynamic html with Django template language by passing context to templates via render, access variables in templates, and display post data and lists on the home page.
Learn how to pass a post list from views to templates and render it dynamically with Django template language tags, looping over posts to display titles and content.
Learn to use if, else, and elif in Django template language to handle empty post lists and display 'no post available' messages on the home page.
Learn how to display a message when a post list is empty in Django templates using the empty tag and for loop variables like counter, counter zero, first, and last.
Discover how to use Django template filters to transform variable values for display, including capfirst, title, truncate words, and truncate chars, and learn to chain filters for concise post previews.
Learn to create a dedicated post template, render it with a post detail view, pass the post dict as context, and fetch posts by id via the url.
Show how to replace hardcoded links with Django's URL tag for dynamic reverse URL generation in templates, using post id to build post and home URLs and maintain navigation.
Learn to configure the dirs setting in Django to locate templates outside apps, using base dir paths to a project templates folder and render a global template.
Learn how template inheritance centralizes common HTML such as navbar and footer using a base template, extends, and blocks to render page-specific content across templates.
Learn to work with static files in Django by configuring the staticfiles app, setting static url, organizing per-app static folders, and referencing css with the load static tag in templates.
Learn to manage global static files in Django, including CSS and JavaScript, shared across templates. Configure static dirs and link style.css via base.html for home and post pages.
Learn to add templates and bootstrap styling to a Django project, using template inheritance and dynamic post rendering with for loops and URL tags.
Learn to use the Django template language to include a reusable post card html, avoid duplication, and pass data between templates via the include tag.
Learn how to implement a custom 404 page in Django by raising Http404, creating a 404.html template, and understanding behavior in development versus production.
Learn to use Django context processors to dynamically provide categories across all templates, replacing hardcoded lists and following the dry principle.
Explore databases in the Django context by comparing relational SQL databases with NoSQL options and understanding how SQL uses tables, columns, and rows.
Explore the Django ORM, an object-relational mapper that lets you interact with the database using Python while behind the scenes it generates SQL and maps data types.
Learn how Django models map Python classes to database tables. Define a model by subclassing models.Model, with attributes as columns, and Django adds an auto-incrementing id as the primary key.
Define the posts model in models.py, including post_title (char field, max 60), post_content (text field), and published_date (date time field with auto_now) for SQLite storage.
Learn how django migrations translate model changes into database tables by using make migrations and migrate, illustrated with a post model and 0001_initial.
Learn how to use Django's show migrations and migrate commands to apply changes, including converting a post's published date from datetime to date.
Learn how to add data to a Django database using two methods: creating a post model instance and using post.objects.create, with auto fields like id and published date handled automatically.
See how Django ORM converts a post.objects.create call into SQL, runs it against the database, and how to inspect the generated queries with connection.queries in development mode.
Retrieve all data from the database using Django's post.objects.all, explore the queryset concept, and access rows as objects, illustrating how Django ORM translates to SQL.
Explore how to use get, filter, and exclude to retrieve single objects, fetch multiple rows, and omit specific values in Django querysets, demonstrated on a school student model.
Explore how to manipulate Django querysets with order_by, reverse, and values to switch between objects and dictionaries, then use count, filter, get, contains, first, and last.
Learn to query data in Django using and and or operators with queryset filters, retrieving rows where student class is 12 and age is 18.
Learn how to use the Q object in Django to build complex queries, combining conditions with and, or, and not operators, and filter results by student class and age.
Learn to limit Django querysets with Python-like slicing, using SQL limit behind the scenes, including start-end slicing, ordering to fetch last items, and the caveat against negative slicing.
Learn to write Django queries with field lookups to filter data, using age comparisons such as greater than or equal to, and lookups like starts with and in.
Learn how Django querysets are lazy, delaying SQL until data access, and how operations like order, filter, and slicing trigger evaluation.
Update a single row in Django by retrieving it with get, altering fields, and calling save. Update multiple rows using a queryset update on all or filtered results.
Delete data in Django by retrieving a single row with get and deleting the object; delete multiple rows by filtering age >= 18 and deleting the queryset.
Fetches all posts from the post model in the home view, passes them to the index.html template, and renders titles, content, and published dates in a for loop.
Fetch a single post from the database by id, render its title, content, and publish date in a template, and handle missing records with a 404 response.
Use the Django shortcut get_object_or_404 to fetch a post by id without try/except, raising a 404 page when no object exists, streamlining error handling in post views.
Explore Django aggregation by using the aggregate method on a queryset to compute statistics with avg, max, and min, and see how keys like age__average appear in the result.
Explore the built-in Django admin panel to manage blog data and user accounts, and learn to access it via the admin/ URL and configure it in settings.
Create a Django superuser with manage.py, log in to the admin panel, and explore authentication basics and admin features such as groups, users, and theme options.
Learn to register models in the Django admin panel using admin.py, import models, and register with admin.site.register, then customize the display with a __str__ method returning self.post_title.
Explore the django admin panel to manage models, view recent actions, and switch themes. Create, update, and delete posts with the admin panel, and verify changes on the site.
learn to customize the Django admin with a model admin class, using list_display and list_display_links to show id, post title, and publish date, and register the model.
Learn to add list filters and search fields to the Django admin for a post model, filtering by publish date and title while enabling pagination.
Customize the Django admin panel by changing the header and index title to your blog name using admin.site.site_header and admin.site.index_title. See updates across the login page and all admin pages.
Discover how Django handles forms to collect user input, validate data, and store it in the database, with Django forms simplifying validation and error display, while emphasizing secure input.
Learn to create Django forms as Python classes inheriting the built-in form, defining fields with labels and input attributes. Render these forms in views and templates with form tags.
Create a Django form in forms.py using a class that inherits forms.Form with a CharField name, render it in the view and template, and add form tag and submit button.
Learn get and post form methods, when to use each, and how the action attribute sends data to the server, with data in the url or request body and CSRF.
Understand how cross-site request forgery works and how django uses csrf tokens to prevent it, including adding the csrf token in templates and using the csrf middleware token.
Handle Django form submissions by checking request.method, using a form with request.post, validating with form.is_valid, then accessing cleaned_data and redirecting to a thank you page.
Follow the step-by-step Django form submission flow: define the teacher form, render it in the home view, handle post data, validate, display errors, and redirect on success to prevent resubmission.
Explore Django form fields, including char, boolean, choice, email, and integer fields; learn about default widgets, min and max length validators, and client-side and server-side validation.
Explore core field arguments in Django forms, including global options such as required, label and label suffix, help text, and customizable error messages with min length.
Explore how Django renders forms with different output styles, including as_table, as_ul, and as_p, and learn when to wrap form fields in table, div, ul, or p tags.
Learn to manually render Django form fields in templates for precise control. Access each field, render label and input, show help text and errors, then wrap in custom HTML.
Loop through a Django form in a template to render each field's label, input, errors, and help text, avoiding repetitive code.
Learn how Django forms render fields with default widgets, swap to custom widgets like text area for bio, and customize HTML with the widget's attributes dictionary.
Learn to style a Django form by applying custom CSS classes and IDs via widget attrs, enabling Bootstrap integration with form control and button classes, and conditionally rendering help texts.
Discover how to implement custom validation on a Django form with the clean method, using cleaned_data to ensure name and email start with s, and raise forms.ValidationError to display errors.
Learn to add custom validation to a Django form field using built-in validators and a custom validator that enforces the name to start with S, extending to the email field.
Learn to style Django form errors by targeting the error-list ul and its li items, applying CSS to display errors in red with white text.
Master CRUD with django forms by building a teachers model, migrating, and using forms to create, read, update, and delete records with templates and CSRF protection.
Learn how to use Django model forms to auto-create forms from models, streamlining CRUD operations and storing user input in the database.
Create a Django modal form from a model by subclassing forms.ModelForm and defining a meta class with the model and fields.
Leverage django model forms to save submitted data directly to the database by calling the form's save method, simplifying create and update operations for the teacher model.
Learn to customize Django model forms by setting field labels, widgets, help texts, and error messages, and apply CSS classes for styling through the meta 'labels', 'widgets', 'help_texts', and 'error_messages'.
Learn how to perform crud operations using model forms in Django, including creating, updating via instance, and deleting objects. Get practical guidance on importing models, handling post requests, and redirects.
Learn to implement the clean method in a Django model form, override fields to add validators (including a custom validator), and configure widgets and labels for name and email.
Master Django model forms by using the fields attribute to include all fields with __all__, or switch to a field list and use exclude to omit specific fields.
Learn how Django creates and manages cookies to support tracking, authentication, and user theme preferences by storing name-value pairs in the browser.
Learn to work with cookies in Django by creating views to set, read, update, and delete cookies, control lifespans with max age, and explore secure and HTTP only options.
Learn how to use cookies with Django's render function by returning an HTTP response, setting and deleting cookies, and working with templates.
Explore cookies limitations, including a 4 KB size cap, a limit on the number of cookies, and security risks from client modifications; sessions offer a more secure alternative.
Learn what middlewares are and how they work in Django, laying the groundwork for cookies, sessions, and authentication.
Understand how Django middlewares act as a lightweight plugin system that globally alters requests and responses, wired in settings.py and processed in order with responses returning in reverse.
learn to create custom middleware in django using a python function or class, wiring it in the settings and using get_response to process requests before and after views.
Transform function based Django middleware into a class based version, defining __init__ and __call__, registering in the middleware list, and executing code before and after views to inspect request paths.
Discover how to return an HTTP response from class-based and function-based Django middleware, and understand middleware ordering and its impact on views.
Understand how class-based Django middleware hooks manage requests and responses, using process_view before a view runs and process_template_response after the view, including error handling with process_exception.
Explore Django's built-in middlewares and learn what each is responsible for, including session and authentication middlewares, and consult the official documentation for more.
Explore sessions in django, including what they are and how they work, and understand why they matter for authentication, using a sessions app and urls in a django project.
Learn how Django stores user data on the server with sessions, using a cookie that holds the session key to retrieve data from the Django_session table.
Learn how Django sessions store data via the session middleware, using request.session to set, get, update, and delete values, and observe cookies and the Django session table.
Learn how to manage Django sessions by deleting session data with del, and how to completely remove a session using request.session.flush to delete cookies and the session table row.
Explore Django session methods to set expiry by seconds or date, and clear expired sessions. Learn to flush, delete on zero, and read expiry age and date.
Learn how Django persists session changes by updating a session dictionary and setting request.session.modified to true to save nested updates, including expanding expiry to two weeks.
Learn how to configure Django session settings in settings.py, including session_cookie_age, session_cookie_name, http only flags, and how to expire sessions on browser close.
Python Django 2026 - The Complete Course (MVT, ORM, Auth, ChatGPT & More)
Welcome to this complete Django course for beginners. I will teach you everything you need to know to become an Expert Django developer. You will master the Django web framework.
In this course, I start each new topic with WHAT, WHY, and HOW to clarify everything. You will also learn how to use AI tools like ChatGPT to assist with your Django development to stand out from other Django developers and boost your career. This will help you make your Django development easier and build websites faster. In today’s AI-driven world, companies want Django developers who can use AI to work more efficiently.
After completing all the parts of this course, you will be ready to start freelancing on Django projects or apply for entry-level Django developer jobs.
I am Taranjot Singh, your instructor for this course. I have over 4 years of experience with Django. I have seen new Django versions launching and old features get deprecated. With my experience, I can keep track of all the latest features and best practices. If you enroll in this course, I will keep you updated with all the latest features and best practices.
Before we talk about the course, let’s take a look at some reviews from my students about my courses and teaching style:
- “The instructor is very detailed and explains not only how to accomplish things but also why it is done.” - Gary E L
- “What a lecture... I am just amazed...alhamdulillah. Thanks a lot for your effort sir ” - Sahira Ahmed
- “I started from zero knowledge in django, to almost 90% confident to face django problems.I really liked this course!!!” - Vishal S.
- “Thanks, it’s a gold mine for a noob like me! <3” - Co_Li
- “You are the best for sure, a lot of learners know how to code with Django but few understand what really happens under the hood. This is not my first time with Django, now I feel like I've been pronouncing words in the language that I didn't even know what they meant. Thank you!” - @ak47-qinr
These are just a few reviews from my other Django courses. I have many more like these, but I can't include all of them here.
This course teaches Django from scratch, requiring only basic Python, HTML, and CSS knowledge. You will start this course first by learning the roots of Django for example What & Why Behind Django Project & Understanding Concepts like Apps Using Real World Examples. We will deep dive into every topic, exploring how it works behind the scenes. We will also thoroughly understand database interactions in Django, including how ORM works and generates SQL. Each section is connected for example before learning about Authentication & How it works behind the scenes. We will first learn about Cookies, Middlewares & Sessions to understand how authentication works behind the scenes. We need to learn cookies, middlewares & sessions because they are the root of Django's built-in authentication. This course isn’t for those who want to quickly learn Django but is for those who want to deep dive & want to master Django because this course is going to be very large.
Here’s what you’ll learn in this first part of the course:
Installing Django & Course Setup.
URLs & Views.
Templates, Context Processors & Static Files.
Databases, ORM & Models.
Admin & ModelAdmin.
Working with Forms & ModelForms.
Cookies in Django.
Middlewares in Django.
Working with Sessions.
Authentication & Authorization in Django.
Pagination.
Relationships in Django.
Handling File Uploads & Images.
Adding More Features.
Deep Dive into Class-Based Views.
Using ChatGPT to Boost Your Development
This course is not just about theory. You will build an one major project: An advanced Blog website which will includes all features that modern blog applications have. By working on these projects, you will apply what you learn in a realistic environment.
Is this course for you?
Beginners: Perfect if you’re starting with zero knowledge.
Intermediate Users: Ideal if you want to deepen your understanding of Django.
Advanced Users: Great for those seeking in-depth knowledge on specific topics like ORM, authentication, and more.
This course comes with a 30-day money-back guarantee. Don’t miss the opportunity to become an expert Django developer. Enroll now and let's get started on your journey to mastering Django!