Course Details
Duration: 3 Days; Instructor-led
Introduction to Python and Django course starts by teaching students the basics of Python, then moves on to teach students how to develop Web applications using the Django framework. This class covers basics of creating basic applications using the MVC (model-view-controller) design pattern, as well as more advanced topics such as administration, session management, authentication, and automated testing.
Audience
- Anyone who needs to learn how to write programs in Python
- Anyone who wants a solid exposure to Python as their first programming language
- Anyone who needs to learn Django framework
Prerequisites
Participants should already be comfortable using the operating system Windows on which they will be running Python. While not mandatory, basic skills with at least one other programming language are desirable. All students should have a working knowledge of HTML5 and CSS.
Methodology
This program will be conducted with interactive lectures, PowerPoint presentation, discussion, and practical exercise.
Course Objectives
All students will:
- Develop full-stack web sites
- Use python data types appropriately
- Define data models
- Understand the architecture of a Django-based web site
- Create Django templates for easy-to-modify views
- Map views to URLs
- Take advantage of the built-in Admin interface
- Provide HTML form processing
Outlines
Module 2: Iterators
- Introduction
- List Comprehension
- Set Comprehension
- Iterator vs Iterable
- Looping through an Iterator
- Creating an Iterator
- Stopping Iteration
- Infinite Iterators
Module 3: Lambda
- Functions
- Variable-length arguments
- Anonymous Functions
- Lambda Operator
- Map function
- Mapping a List of Functions
- Filtering
- Reducing a List
- Reduce function
Module 4: Errors and Exceptions
- Introduction
- Exception handling
- Multiple except clauses
- Custom made Exceptions
- Clean-up Actions (try … finally)
- Combining try, except and finally
- Else Clause
Module 5: Generators
- Introduction
- Method of Operation
- Using a ‘return’ in a Generator
- Send Method / Coroutines
- The throw Method
- Decorating Generators
- Yield from
- Recursive Generators
- A Generator of Generators
Module 6: Decorators
- Introduction
- Functions inside Functions
- Functions as Parameters
- Functions returning Functions
- A Simple Decorator
- Syntax for Decorator
- Use cases for Decorator
- Decorators with Parameters
- Classes instead of Functions
Module 7: Object oriented programming
- Introduction
- First-class Everything
- A Minimal Class in Python
- Attributes
- Methods
- The __init__ method
- Data Abstraction
- Data Encapsulation and Information Hiding
- __str__ and __repr__ method
- Public Private and Protected Attributes
- Destructor
- Class and Instance Attributes
- Static Methods
- Class Methods
- Properties vs Getters and Setters
Module 8: Inheritance
- Introduction
- Syntax Inheritance
- Overloading
- Overriding
- Multiple Inheritance
- Diamond Problem
- Super and MRO
- Polymorphism
- Slots
- Avoiding Dynamically created Attributes
Module 9: Dictionaries and Sets
- About dictionaries
- Creating dictionaries
- Iterating through a dictionary
- About sets
- Creating sets
- Working with sets
Module 10: Functions
- About sequences
- Function parameters
- Global variables
- Global scope
- Returning values
- Sorting data
Module 11: Errors and Exception Handling
- Syntax errors
- Exceptions
- Using try / catch / else
- Using finally
- Handling multiple exceptions
- Ignoring exceptions
Module 12: Using Modules
- The import statements
- Module search path
- Zipped libraries
- Creating Modules
- Function and Module aliases
Module 13: Classes
- About o-o programming
- Defining classes
- Constructors
- Instance methods and data
- Class
- Static methods and data
- Inheritance
Module 14: Django Architecture
- Sites and apps
- Shared configuration
- Minimal Django layout
- Built in flexibility
Module 15: Configuring a Project
- Executing manage.py
- Starting the project
- Database setup
- The development server
Module 16: Adding an Application
- Generate the application files
- Defining models
- Related objects
- SQL Migration
- App configuration
- Accessing models
Module 17: Login for Nothing and Admin for free
- Setting up the admin user
- Running the admin site
- Tweaking the admin interface
- Changing the admin index page
Module 18: Basic Views (AKA Controllers)
- What is a view
- HttpResponse
- URL route configuration
- Shortcut: get_object_or_404()
Module 19: Basic Views (AKA Templates)
- About templates
- Django template syntax
- Static files
- Loading templates
- The URL tags
Module 20: Querying the Models
- QuerySets
- Field lookups
- Chaining filters
- Slicing QuerySets
- Related fields
- Q objects
Module 21: Working with Templates
- Variable lookups
- Comments
- Inheritance
- Filters
- Escaping HTML
- Custom filters
Module 22: Forms
- Forms overview
- GET and POST
- The Form classes
- Processing the form
- Widgets
- Validation
- Forms in templates
- Beyond the basics
Module 23: Integrating a MySQL Database
- The g (global) object
- Creating a table
- Inserting rows
- Making queries