liveBook · Manning

What you will learn in Django in Action

by Christopher Trudeau
Foreword by Michael Kennedy

Chapter by chapter

Chapter 1: Django unfolds

1.1 Django’s parts · 1.1.1 Mapping URLs, Django views, and the MVC model · 1.1.2 Databases: Dynamic sites need data · 1.1.3 Structuring HTML for reuse · 1.1.4 Multiuser sites · 1.2 What can you do with Django? · 1.2.1 Server-side, single-page, and mixed-page applications · 1.2.2 When and where you should use it · 1.2.3 Potential projects · 1.2.4 The RiffMates project · 1.3 Summary

What you learn in chapter 1 →

Chapter 2: Your first Django site

2.1 The RiffMates project · 2.2 Creating a Django project · 2.3 Projects vs. apps · 2.4 Your first Django app · 2.5 Your first Django view · 2.6 Registering a route · 2.7 Visiting your view · 2.8 Exercises · 2.9 Summary

What you learn in chapter 2 →

Chapter 3: Templates

3.1 Where to use templates · 3.2 Context objects and the parts of a Template · 3.3 Django shell · 3.4 Rendering a Template · 3.5 Common tags and filters · 3.5.1 Conditional blocks · 3.5.2 Looping blocks · 3.5.3 Comment blocks · 3.5.4 Verbatim blocks · 3.5.5 Referencing URLs · 3.5.6 Common filters · 3.6 Using render() in a view · 3.7 Escaping special characters · 3.8 Composing templates out of blocks · 3.8.1 Writing a base template file · 3.8.2 Including an HTML snippet · 3.9 Exercises · 3.10 Summary

What you learn in chapter 3 →

Chapter 4: Django ORM

4.1 Interacting with a database · 4.2 ORM Models · 4.3 SQLite and dbshell · 4.4 Model queries · 4.4.1 Using .all() and .filter() to fetch QuerySet results · 4.4.2 Field look-ups · 4.5 Modifying your data · 4.6 Querying models in views · 4.6.1 Using URL arguments · 4.6.2 Listing pages · 4.6.3 Using query parameters for pagination · 4.7 Model relations · 4.7.1 One-to-many relationships · 4.7.2 Many-to-many relationships · 4.8 Model fields · 4.8.1 Popular cross-field field options · 4.8.2 Popular fields · 4.9 Fixtures · 4.10 Danger zone, or know thy SQL · 4.11 Exercises · 4.12 Summary

What you learn in chapter 4 →

Chapter 5: Django Admin

5.1 Touring the Django Admin · 5.1.1 Creating an admin user · 5.1.2 The default Django Admin · 5.1.3 Adding your own models · 5.2 Customizing a listing page · 5.2.1 Sorting and searching · 5.2.2 Filtering · 5.2.3 New in Django 5: Facets · 5.3 Cross-linking between related objects · 5.4 Model Meta properties · 5.4.1 Sort order · 5.4.2 Indexes · 5.4.3 Uniqueness · 5.4.4 Object names · 5.5 Exercises · 5.6 Summary

What you learn in chapter 5 →

Chapter 6: User management

6.1 Multiuser websites · 6.2 Storing user data · 6.2.1 Choosing a user account mechanism · 6.2.2 Adding a user profile · 6.3 Restricting access to views · 6.4 Authorization in views · 6.4.1 Handling logouts · 6.5 Using signals to automatically create a user profile · 6.6 Password management · 6.6.1 Password reset page · 6.6.2 Password reset email · 6.6.3 New password form · 6.7 Exercises · 6.8 Summary

What you learn in chapter 6 →

Chapter 7: Forms, user data, static files, and uploads

7.1 Web forms · 7.1.1 Handling GET and POST in views · 7.1.2 CSRF · 7.1.3 Beautifying web forms · 7.1.4 New in Django 5: Reusable field group templates · 7.2 Django ModelForm · 7.2.1 Validating fields in a model · 7.2.2 A ModelAdmin for SeekingAd using Truncate · 7.2.3 Writing a ModelForm · 7.2.4 Using SeekingAdForm in a view · 7.2.5 Editing existing data with forms · 7.3 Serving static files · 7.4 Uploads · 7.4.1 Configuring your project for uploads · 7.4.2 Storing and referencing uploaded files · 7.4.3 File upload forms and views · 7.4.4 Restricted file downloads · 7.5 Exercises · 7.6 Summary

What you learn in chapter 7 →

Chapter 8: Testing your project

8.1 Automated testing · 8.1.1 The scope of tests · 8.1.2 Automated testing in Python · 8.2 Your first Django test · 8.3 Testing with the database · 8.4 Expecting errors · 8.5 Authenticating and posting data · 8.6 Testing with file uploads · 8.7 More testing techniques · 8.7.1 LiveServerTestCase for Selenium · 8.7.2 Third-party helpers · 8.8 Measuring tests and code quality · 8.9 Exercises · 8.10 Summary

What you learn in chapter 8 →

Chapter 9: Management commands

9.1 Management commands in practice · 9.1.1 Built-in management commands · 9.1.2 Changing a password · 9.1.3 Configuration · 9.1.4 Flushing the database · 9.1.5 SQL commands · 9.2 Writing your own management command · 9.3 Handling arguments · 9.3.1 Built-in arguments · 9.4 Testing, and using STDOUT and STDERR · 9.5 Exercises · 9.6 Summary

What you learn in chapter 9 →

Chapter 10: Migration

10.1 Migration scripts in detail · 10.1.1 An initial migration · 10.1.2 Changing a model · 10.2 Migration with existing data · 10.3 Squashing a migration · 10.4 More migration choices · 10.5 Exercises · 10.6 Summary

What you learn in chapter 10 →

Chapter 11: APIs

11.1 Why use an API? · 11.1.1 CRUD and REST · 11.1.2 Versioning an API · 11.2 Building an API with Django Ninja · 11.2.1 Serializing objects · 11.2.2 Handling arguments · 11.2.3 Filtering your listings · 11.2.4 Nesting data · 11.2.5 Authenticating your API · 11.2.6 Creating objects with the API · 11.2.7 Updating and deleting with the API · 11.3 Other API libraries · 11.4 Exercises · 11.5 Summary

What you learn in chapter 11 →

Chapter 12: Making your pages more dynamic with HTMX

12.1 Dynamic web pages · 12.2 HTMX attributes · 12.3 Lazy loading · 12.4 Search-as-you-type with infinite scroll · 12.5 Click to edit · 12.6 Exercises · 12.7 Summary

What you learn in chapter 12 →

Chapter 13: Django power tools

13.1 Django Debug Toolbar · 13.2 Tool libraries · 13.2.1 Django Extensions · 13.2.2 Django Awl · 13.3 Look and feel · 13.3.1 Django Grappelli · 13.3.2 Crispy forms · 13.3.3 Favicons · 13.4 Feature flags · 13.5 Static sites · 13.6 Summary

What you learn in chapter 13 →

Chapter 14: Where to go next

14.1 Within Django · 14.2 Configuration · 14.3 Dealing with data · 14.4 Web tools · 14.5 Asynchronous actions · 14.6 A wide world

What you learn in chapter 14 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.