Web Development · WDC-55

Advanced Python Django

Advanced Python Django is a course for taking Django 6 web applications further, covering advanced templates and forms, faster models and queries, sessions, permissions in the Django admin, the Debug Toolbar, Redis caching, background tasks and deployment with Docker. It suits developers and IT staff who have already built web sites with Django.

Updated
From 8,010 THB / person 8,900 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration18 hours · 3 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

Once a Django site has real users, more data and several roles using it, the work changes from making pages work to making the system fast, secure, finely permissioned and easy to maintain. Django has built-in tools for all of this, from caching, sessions, permissions and a customisable admin site to the Tasks framework and Content Security Policy added in Django 6.

This course builds on Django basics, moving on to advanced templates and forms, richer models and fast ORM queries, sessions, users and permissions in the Django admin, admin customisation and finding slow spots with the Debug Toolbar. Learners cache with Redis, run work in the background, configure security, serve data through a RESTful interface and finish by deploying with Docker and Nginx on Django 6.1. (3 days, 6 hours per day, 18 hours in total, Advanced level.)

What you’ll gain

  • Structure a Django project and split settings by environment
  • Use advanced templates, template partials and forms
  • Extend models and write fast queries free of N+1 problems
  • Manage sessions, users and permissions in detail by role
  • Customise the Django admin and control who can edit what
  • Find slow spots with the Debug Toolbar and cache with Redis
  • Run work in the background and configure web security
  • Serve data through a RESTful interface and deploy with Docker

Who this course is for

  • Developers who have built sites with Django and want to take systems into production
  • IT staff and system administrators who look after internal systems built with Django
  • Teachers, lecturers and trainers who teach web development with Python
  • Students and others who have completed a basic Django course

Prerequisites

  • Able to write Python and understand basic OOP
  • Have built a site with Django, including models, views, templates and forms
  • Basic understanding of HTML, CSS and SQL
  • A laptop that can run Docker Desktop

Curriculum

Course Details

This course is the 2026 edition of Advanced Python Django. It runs for 3 days, 6 hours per day (18 hours in total, 09:00-16:00), as lectures with labs. Advanced level. This edition moves to Django 6.1 on Python 3.14 and PostgreSQL 18, adds template partials, the Tasks framework and Content Security Policy from Django 6, adds work on slow queries, uses Redis for caching and replaces deployment on PythonAnywhere with

Gunicorn, Nginx and Docker Compose. It keeps the original core of advanced templates and forms, extending models, sessions, users and permissions in the Django admin, admin customisation, the Debug Toolbar, caching and a RESTful interface. It builds on Basic Python Django and stays separate from Building REST APIs with Python, which covers APIs in full. Every lab uses open source or free tools. Learners take home a lab guide and the source code.

Day 1 Project Structure and Advanced Templates, Forms and Models

Section 1: Lab: A Production-Ready Project Structure

  • Review MVT and how a request passes through middleware
  • Manage the project with uv and run PostgreSQL 18 on Docker
  • Split settings for development and production
  • Keep secrets in environment variables instead of in code
  • Lab: set up the membership and article library project used throughout the course

Section 2: Lab: Advanced Templates

  • Multi-level template inheritance and systematic use of include
  • Template partials with partialdef and loading one part with #partial-name
  • Create custom filters, simple tags and inclusion tags
  • Autoescaping against XSS, and using mark_safe with care
  • Lab: multi-level layouts and reusable display components

Section 3: Lab: Advanced Forms

  • Customise field-level and form-level validation with clear error messages
  • Custom widgets and customising form rendering with templates
  • Formsets and inline formsets for editing several records at once
  • Upload files safely and limit their type and size
  • Lab: an order form with several product lines on one page

Section 4: Enhancing Models

  • Custom methods, properties and overriding save and delete
  • Custom managers and querysets for frequently used queries
  • Complex relationships with ManyToMany through models
  • Constraints, indexes and GeneratedField at database level
  • Lab: article, author, tag and publishing status models

Section 5: Lab: Fast Queries with the ORM

  • The N+1 query problem and how to spot it
  • select_related, prefetch_related and the new fetch_mode in Django 6.1
  • only, defer, annotate and Subquery
  • Transactions with atomic and select_for_update
  • Lab: cut the number of queries on the article list page
Day 2 Sessions, Users, Permissions and the Django Admin

Section 6: Lab: Sessions and Cookies

  • Enabling sessions and the different session backends
  • Session cookies and the Secure, HttpOnly and SameSite settings
  • Read and write the session from views
  • Signed cookies and when to keep data on the server
  • Lab: a shopping cart and user preferences stored in the session

Section 7: Users and Permissions

  • A custom user model and choosing AbstractUser
  • The model permissions Django creates and custom permissions
  • Check permissions with has_perm, permission_required and PermissionRequiredMixin
  • Groups for business roles such as editors and writers
  • Lab: set up administrator, editor and writer roles

Section 8: Lab: Controlling Permissions in the Django Admin

  • A custom user admin and showing each user's permissions
  • Prevent editing of fields, permanently or by condition
  • Stop non-superusers granting superuser status or editing their own permissions
  • Grant permissions only through groups and restrict access to custom actions
  • Lab: a back office where each role can see and edit different things

Section 9: Lab: Customising the Django Admin

  • Order fields with fieldsets and readonly_fields
  • Search, filters and list_editable on list pages
  • Inlines and autocomplete_fields for related data
  • Admin actions and overriding admin templates
  • Lab: a practical admin site for the editorial team

Section 10: The Debug Toolbar and Logging

  • Install and configure django-debug-toolbar for development only
  • Read the SQL, template, cache and timing panels
  • Find slow spots and repeated queries on real pages
  • Configure logging by level and record system errors
  • Lab: measure before and after query tuning with the Debug Toolbar
Day 3 Caching, Background Work, Security, APIs and Deployment

Section 11: Lab: Caching with Redis

  • Types of cache and configuring Django's built-in RedisCache
  • Cache the whole site with middleware and single views with cache_page
  • Cache parts of a template with the cache tag
  • The low-level cache API and clearing the cache when data changes
  • Lab: cache the home page and the list of popular articles

Section 12: Background Work and Signals

  • The Django 6 Tasks framework with @task and enqueue
  • Task backends for development and choosing a worker for production
  • Signals such as post_save and when not to use them
  • Async views and work that suits ASGI
  • Lab: send an email notification when an article is approved

Section 13: Lab: Securing a Django Site

  • CSRF, clickjacking and SQL injection protection built into Django
  • Content Security Policy with the new middleware in Django 6
  • Configure HTTPS, HSTS and secure cookies for production
  • Check settings with check --deploy
  • Lab: close the risky spots before going live

Section 14: A RESTful Interface with DRF

  • The Django REST Framework and RESTful ideas
  • Serialization with Serializer and ModelSerializer
  • DRF requests and responses
  • Function-based and class-based API views
  • Lab: an article list API with read and write permissions

Section 15: Workshop: Deploying with Docker and Nginx

  • Keep the code on GitHub and write a Dockerfile for Django
  • Collect static files and run Django with Gunicorn
  • Docker Compose for Django, PostgreSQL, Redis and Nginx
  • Migrations, creating an administrator and checking the system after deployment
  • Workshop: the article library system ready for a real server

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

How do template inheritance and template partials work in Django?

Create a main template such as base.html with the shared page structure and mark the parts that differ with block tags. Child templates use extends to point to base.html and only fill in the blocks they replace, and this can be nested over several levels. Template partials, added in Django 6, let you declare a fragment in the same file with partialdef, reuse it with the partial tag, or load just that fragment from a view using the template name followed by # and the partial name.

At what levels can caching be set up in Django?

Django caches at several levels: a per-site cache for the whole site through middleware, a per-view cache with the cache_page decorator, template fragment caching with the cache tag, and the low-level API with cache.set and cache.get for any value. Storage can be Redis, which has a built-in Django backend, Memcached, the database, files or local memory, set in CACHES in settings.py, and you need a plan for clearing the cache when data changes.

How do you manage user permissions in Django Admin with permissions and groups?

Django creates basic permissions for every model automatically: add, change, delete and view. Create groups for roles such as editors or writers, attach permissions to the groups and add users to groups rather than granting permissions one by one. In code, check permissions with user.has_perm, the permission_required decorator or PermissionRequiredMixin, and customise ModelAdmin to lock certain fields, for example so non-superusers cannot grant superuser status to others.

Who is the Advanced Python Django course for, and what should I know beforehand?

It suits developers, IT staff, teachers and students who already use Django and want to take systems into production. You should be able to write Python, have built a site with Django including models, views, templates and forms, understand basic HTML, CSS and SQL, and bring a laptop that can run Docker Desktop. If you have not used Django before, take Basic Python Django first.

What will I be able to do after the Advanced Python Django course?

You will be able to structure a project and split settings by environment, use template partials, custom tags and formsets, extend models and write queries free of N+1 problems, manage sessions, customise the Django admin and role-based permissions, use the Debug Toolbar and Redis caching, run background work with the Tasks framework, configure security, build an API with the Django REST Framework and deploy with Docker and Nginx. Participants who complete the training receive a Certificate of Completion with its own number, which can be verified online.

Which tools are used on the Advanced Python Django course?

The course uses Python 3.14 with projects managed by uv, Django 6.1, and PostgreSQL 18 and Redis running on Docker Desktop. django-debug-toolbar is used to inspect requests and database queries, the Django REST Framework to build APIs, GitHub to keep code, and Gunicorn, Nginx and Docker Compose for deployment. All are open source or free, so you need a computer on which you can install software and a GitHub account.

Related articles

Articles are published in Thai.