# Django Web Framework

## About

- Level: Intermediate to Advanced
- Lectures: 30 hours
- Self-study: 15 hours
- Exercises: 144
- Lines of code to write: 509
- Format: e-learning + weekly online meeting with the instructor
- Language: English or Polish

## Description

Build a Django application from its first project files through models, views, templates, forms, and deployment preparation. Add authentication, permissions, and APIs while practicing tests and database queries. The exercises connect individual framework features into a working service.

## Advantages

Learn how Django's built-in components fit together and how to investigate common problems in requests, forms, and database access. You will build habits for testing features, managing migrations, and preparing a release.

## Target Audience

- Python developers starting or maintaining a Django application.
- Backend engineers working on forms, accounts, databases, and APIs.
- Developers who want a structured path from setup to deployment.

## Format

Learn through short videos and worked examples, then apply each topic in coding exercises. Automated checks help you test your solutions, and a progress spreadsheet helps you see what to work on next.

Weekly online meetings give you time for questions, code reviews, and working through difficult exercises with the instructor. Downloadable code, exercise templates, and reference notes support your independent practice.

Our trainers prepare the teaching materials from their professional experience. The materials have been developed since 2015, with more than 28,000 automated tests checking the code examples. Training is available in English or Polish.

## Course Outline

1. Introduction to Django:

   - Examples of services using Django
   - Django versions and update strategy
   - Installing Django
   - Configuration file
   - `manage.py` and its options
   - Built-in HTTP server (local listening and listening on all interfaces)
   - Run configurations in the IDE
2. Projects:

   - The concept of a Django project
   - Creating a new project
   - Directory structure
3. Settings:

   - Debug mode and configuration via environment variables
   - Secret Key and secrets
   - Event logging configuration
   - Cache and database configuration
4. Applications:

   - The concept of Django projects and applications
   - Creating a new application
   - Application structure
   - Reusability concept vs. practice
5. Models:

   - Models in Django
   - Character, numeric, boolean, special, composite fields, and relationships
   - Relationships between models: ForeignKey, OneToOne, ManyToMany
   - Field parameters: uniqueness, null values, database indexing, required fields
   - Limiting choices
   - Automatic date population
   - Validators
   - Migrations and their management
   - Data dump and restore from backup
   - Creating custom fields
   - Meta class
6. Admin Panel:

   - Creating a superuser
   - Registering models
   - Admin panel configuration
   - Searching, filtering, autocomplete
   - Fieldsets, radio buttons, checkboxes
   - Custom fields
   - StackedInline and TabularInline
   - Displaying custom fields using `list_display`
   - Limiting querysets (`get_queryset`)
   - Soft deletion (without removing data from the database)
   - Pagination
   - Creating custom filters
   - Injecting custom JavaScript scripts and CSS styles
   - Modifying the admin panel appearance by overriding templates
   - Widgets
7. ORM:

   - Creating simple queries using the ORM
   - Creating objects, saving to the database, updating
   - Retrieving objects, filtering, joining queries, sorting
   - Advanced queries: Q objects, F expressions, grouping and aggregations
   - Using multiple databases simultaneously
   - Database reverse engineering (`inspectdb`)
   - Inspecting database queries
   - Model managers
8. URL Routing:

   - Introduction to regular expressions
   - Django URL resolving mechanisms
   - Connecting views to URLs
   - Reverse URL resolution
   - Redirects
   - Versioning
9. Views:

   - HTTP status codes, request and response headers
   - Class-based and function-based views
   - Generic views
   - Asynchronous views
   - Error handling
   - Handling different request types (JSON, HTTP, CSV)
   - Reading data from requests
   - Access-restricting decorators
10. Templates:

    - Template syntax: variables, tags, filters
    - URL handling
    - Hierarchy, inheritance, and separation of reusable code
    - Template tags
    - Static files: images, CSS, JavaScript
11. Forms:

    - Form class: types, defining form fields
    - Rendering forms
    - Form validation
    - Error handling
    - Creating forms directly from models
    - CSRF
12. Middleware:

    - Request processing mechanism
    - Creating custom middleware
13. Locale, i18n, l10n:

    - Handling different date formats
    - Working with time zones
    - Translating templates and field names (gettext)
    - Handling different numeric formats
    - Translating JavaScript files
14. Authorization and Authentication in Django Applications:

    - Django authentication system (`django.contrib.auth`)
    - Login
    - Session mechanism
    - Defining user and group permissions
    - Restricting access to views
15. API:

    - Creating custom endpoints
    - Handling POST, GET, PUT, PATCH, HEAD, OPTIONS requests
    - API versioning
    - Django REST API (Django Ninja)
    - Generating API documentation
    - Generating class relationship diagrams (Django Extensions Graph)
    - CSRF and CORS
16. Scripts and Management Commands:

    - Creating scripts using Django models and ORM
    - Creating custom management commands
17. Testing:

    - Introduction to the `django.test` module
    - `TestCase` class and Django-specific assertions
    - Test client
    - `Response` class
    - Fixtures
    - Django Debug Toolbar
    - CI/CD for Django applications
18. Deployment:

    - Freezing and managing dependencies
    - Nginx, uWSGI, async WSGI
    - Gunicorn server
    - Serving static files and using CDNs (e.g. AWS S3)
    - Docker and Kubernetes
    - Cache
    - Security

## Our Experience

AATC trainers have taught software engineering since 2015, delivering more than 11,000 hours of training to over 32,000 students worldwide. The exercises draw on that teaching experience and professional projects.

## Prerequisites

- Basic knowledge of Python programming
- Familiarity with using an IDE (e.g., PyCharm, VSCode)
- Familiarity with using version control systems (e.g., Git)
- Basic familiarity with SQL and relational databases
- Basic familiarity with HTTP protocol and REST API concepts
- Understanding of AI-assisted coding tools (e.g., GitHub Copilot, ChatGPT)

## Setup

- Newest version of Python
- IDE of your choice (e.g., PyCharm, VSCode)
- Git installed and configured
- GitHub account
- Web browser (e.g., Chrome, Firefox, Safari, etc.)
- SQLite3 or PostgreSQL database installed locally (e.g., using Docker)

## Related Courses

- [Django](<https://aatc.pl/software/web/django/index.md>)
- [REST API](<https://aatc.pl/software/web/rest-api/index.md>)
- [SQL Databases](<https://aatc.pl/software/web/database/index.md>)
- [DevOps](<https://aatc.pl/software/engineering/devops/index.md>)
- [All Courses](<https://aatc.pl/software/index.md>)

## Date

This course is scheduled on demand. Contact us with your preferred dates and group size so we can check availability and arrange a suitable session.

## Contact

Email [info@aatc.pl](<mailto:info@aatc.pl>) for help with program details, preparation, or booking.

## Apply

To apply, email [info@aatc.pl](<mailto:info@aatc.pl>) with your name, the program you are interested in, and your preferred dates.
