Log In
Or create an account -> 
Imperial Library
  • Home
  • About
  • News
  • Upload
  • Forum
  • Help
  • Login/SignUp

Index
Title Page Copyright Page Contents Preface
Is This Book for Me? What This Book Contains Conventions Used in This Book
Acknowledgments About the Author We Want to Hear from You! Reader Services I: Django’s Core Features
1. Starting a New Django Project: Building a Startup Categorizer with Blog
1.1 Introduction 1.2 Website Basics 1.3 Understanding Modern Websites 1.4 Building Modern Websites: The Problems That Frameworks Solve and Their Caveats 1.5 Django: Python Web Framework 1.6 Defining the Project in Part I
1.6.1 Selecting Django and Python Versions 1.6.2 Project Specifications
1.7 Creating a New Django Project and Django Apps
1.7.1 Generating the Project Structure 1.7.2 Checking Our Installation by Invoking Django’s runserver via manage.py 1.7.3 Creating New Django Apps with manage.py 1.7.4 Connecting Our New Django Apps to Our Django Project in settings.py
1.8 Putting It All Together
2. Hello World: Building a Basic Webpage in Django
2.1 Introduction 2.2 Creating and Integrating a New App 2.3 Building Hello World
2.3.1 Webpage Data 2.3.2 Webpage URL
2.4 Displaying Hello World 2.5 Controller Limitations: The Advantages of Models and Views 2.6 Removing Our Helloworld App from Our Project 2.7 Putting It All Together
3. Programming Django Models and Creating a SQLite Database
3.1 Introduction 3.2 Why Use a Database? 3.3 Organizing Our Data
3.3.1 Accessing Data: Understanding Django’s Slug
3.4 Specifying and Organizing Data in Django Using Models
3.4.1 A First Look at Django Models and Fields 3.4.2 Completing Our Django Models 3.4.3 Adding Relational Fields to Our Models 3.4.4 Controlling Model Field Behavior with Field Options 3.4.5 Adding Methods to Django Models 3.4.6 Controlling Model Behavior with Nested Meta Classes
3.5 Using Django to Automatically Create a SQLite Database with manage.py
3.5.1 Understanding Migrations 3.5.2 Creating Migrations 3.5.3 Applying Migrations to Create or Modify a Database
3.6 Manipulating Data in the Database: Managers and QuerySets
3.6.1 Basic Database Interaction via Models 3.6.2 Database Interaction via Managers
3.7 String Case Ordering 3.8 Putting It All Together
4. Rapidly Producing Flexible HTML with Django Templates
4.1 Introduction 4.2 Revisiting Hello World: The Advantages of Templates 4.3 Understanding Django Templates and Their Goals 4.4 Choosing a Format, an Engine, and a Location for Templates 4.5 Building a First Template: A Single Tag Object
4.5.1 Coding the Foundation of the Template in HTML 4.5.2 Filling in Content with Template Variables 4.5.3 Adding Logic with Template Tags 4.5.4 Controlling the Output of Variables with Template Filters title, length, and pluralize
4.6 Building the Rest of Our App Templates
4.6.1 Template for a List of Tag objects 4.6.2 Template for a Single Startup Object 4.6.3 Template for a List of Startup Objects 4.6.4 Template for a Single Blog Post 4.6.5 Template for a List of Blog Posts
4.7 Using Template Inheritance for Design Consistency
4.7.1 Informing Django of the Existence of Site-wide Templates 4.7.2 Building the Site-wide Generic Template 4.7.3 Using the Generic Template in Our Tag List Template 4.7.4 Building the App-Generic Templates 4.7.5 Using the Generic Templates in the Rest of the App Templates
4.8 Using Templates in Python with the Template, Context, and loader Classes
4.8.1 Using Templates in the Shell 4.8.2 Using Templates in Views
4.9 Putting It All Together
5. Creating Webpages with Controllers in Django: Views and URL Configurations
5.1 Introduction 5.2 The Purpose of Views and URL Configurations
5.2.1 Django URL Configurations 5.2.2 Django Views
5.3 Step-by-Step Examination of Django’s Use of Views and URL Configurations 5.4 Building Tag Detail Webpage
5.4.1 Coding the tag_detail() Function View 5.4.2 Adding a URL Pattern for tag_detail
5.5 Generating 404 Errors for Invalid Queries 5.6 Shortening the Development Process with Django View Shortcuts
5.6.1 Shortening Code with get_object_or_404() 5.6.2 Shortening Code with render_to_response() 5.6.3 Shortening Code with render()
5.7 URL Configuration Internals: Adhering to App Encapsulation
5.7.1 Introspecting URL Patterns 5.7.2 Using include to Create a Hierarchy of URL Configurations
5.8 Implementing the Views and URL Configurations to the Rest of the Site
5.8.1 Restructuring Our homepage() View 5.8.2 Building a Startup List Page 5.8.3 Building a Startup Detail Page 5.8.4 Connecting the URL Configuration to Our Blog App 5.8.5 Building a Post List Page 5.8.6 Building a Post Detail Page
5.9 Class-Based Views
5.9.1 Comparing Class-Based Views to Functions Views 5.9.2 Advantages of Class-Based Views 5.9.3 View Internals 5.9.4 Class-Based Views Review
5.10 Redirecting the Homepage
5.10.1 Directing the Homepage with URL Configurations 5.10.2 Redirecting the Homepage with Views
5.11 Putting It All Together
6. Integrating Models, Templates, Views, and URL Configurations to Create Links between Webpages
6.1 Introduction 6.2 Generating URLs in Python and Django Templates
6.2.1 Reversing URL Patterns 6.2.2 Reversing Regular Expression Patterns with Character Sets 6.2.3 Canonical Model URLs 6.2.4 The NoReverseMatch Exception
6.3 Using the url Template Tag to Build a Navigation Menu
6.3.1 Building the <nav> Menu in HTML and Hardcoding Our Links 6.3.2 Using the url Template Tag to Create URL Paths for the Navigation Menu
6.4 Linking List Pages to Detail Pages
6.4.1 Using url to Create Detail Page Links 6.4.2 Replacing Detail Page Links with get_absolute_url()
6.5 Creating Links on the Object Detail Pages 6.6 Revisiting Homepage Redirection 6.7 Putting It All Together
7. Allowing User Input with Forms
7.1 Introduction 7.2 Django Forms as State Machines 7.3 Creating TagForm, a Form for Tag Objects
7.3.1 Implementing the save() Method for TagForm 7.3.2 Using TagForm in the Django Shell 7.3.3 Form Validation Techniques in Django 7.3.4 Creating a Clean Method for the Tag Model name Field 7.3.5 Preparing to Build a Clean Method for the Tag Model slug Field 7.3.6 Creating a Clean Method for the Tag Model slug Field 7.3.7 Using ModelForm Inheritance to Connect TagForm to Tag 7.3.8 Understanding ModelForm Validation 7.3.9 Updating Objects with ModelForm
7.4 Building the Forms for Startup, Newslink, and Post Models
7.4.1 Creating PostForm 7.4.2 Creating StartupForm and NewsLinkForm
7.5 Putting It All Together
8. Displaying Forms in Templates
8.1 Introduction 8.2 Creating a New Template to Create Tag Objects
8.2.1 Using Template Variables to Make the TagForm Template Dynamic 8.2.2 Displaying Form Errors in tag_form.html 8.2.3 Redisplaying Bound Form Values in tag_form.html 8.2.4 Maintaining the DRY Principle in tag_form.html 8.2.5 Looping over Form Fields 8.2.6 Printing Forms Directly
8.3 Creating a New Template to Update Tag Objects 8.4 Creating a New Template to Delete Tag Objects 8.5 Creating Templates for StartupForm, NewsLinkForm, and PostForm 8.6 Reconsidering Template Inheritance 8.7 Putting It All Together
9. Controlling Forms in Views
9.1 Introduction 9.2 Webpages for Creating Objects
9.2.1 Understanding Expected Form Behavior 9.2.2 Implementing a Webpage to Create Tags 9.2.3 Creating Post Objects in a View with PostForm 9.2.4 Creating Startup Objects in a View with StartupForm 9.2.5 Creating NewsLink Objects in a View with NewsLinkForm 9.2.6 Shortening Organizer Views
9.3 Webpages for Updating Objects
9.3.1 Creating a View to Modify Post Objects 9.3.2 Creating a View to Modify NewsLink Objects 9.3.3 Webpages to Update Startup and Tag Objects
9.4 Webpages for Deleting Objects
9.4.1 Creating a Webpage to Delete Post Objects 9.4.2 Creating a Webpage to Delete NewsLink Objects 9.4.3 Webpages to Delete Startup and Tag Objects
9.5 Putting It All Together
10. Revisiting Migrations
10.1 Introduction 10.2 Last Week’s Episode (Reviewing Chapter 3) 10.3 Data Migrations
10.3.1 Tag Data 10.3.2 Startup Data 10.3.3 Post Data
10.4 Schema Migrations
10.4.1 Making Our Lives Difficult with a Data Migration 10.4.2 Adding a slug to NewsLink 10.4.3 Ensuring a Unique Identifier for NewsLink 10.4.4 Making Relations Optional in Forms
10.5 Putting It All Together
11. Bending the Rules: The Contact Us Webpage
11.1 Introduction 11.2 Creating a contact App 11.3 Creating the Contact Webpage
11.3.1 Contact Form 11.3.2 Contact URL Pattern and View 11.3.3 Contact Templates
11.4 Splitting Organizer urls.py 11.5 Putting It All Together
12. The Big Picture
12.1 Introduction 12.2 Django’s Core 12.3 Webpages with Views and URL Configurations
12.3.1 Views 12.3.2 URL Patterns and Configurations
12.4 Generating Webpages Thanks to Models and Templates
12.4.1 Structuring and Storing Data in Models 12.4.2 Controlling Markup with Django Templates
12.5 Interacting with Data via Forms 12.6 Intervening in Control Flow 12.7 Moving Forward
II: Django’s Contributed Libraries
13. Django’s Contributed Library
13.1 Introduction 13.2 Django’s Source Code (and Versioning) 13.3 Django’s contrib Code 13.4 Content (Not) Covered 13.5 Translation 13.6 Putting It All Together
14. Pagination: A Tool for Navigation
14.1 Introduction 14.2 A Word about URLs: Query versus Path 14.3 Discovering Django Pagination in the Shell 14.4 Paginating the Startup List Webpage 14.5 Pagination of Tag List Webpage Using the URL Path 14.6 Putting It All Together
15. Creating Webpages with Django Flatpages
15.1 Introduction 15.2 Enabling Flatpages 15.3 Anatomy of the App 15.4 Building an About Webpage
15.4.1 Creating a Template 15.4.2 Creating the About FlatPage 15.4.3 Displaying FlatPage Objects via the URL Configuration 15.4.4 Displaying FlatPage Objects via Middleware 15.4.5 Switching Back to a URL Configuration
15.5 Linking to FlatPage Objects 15.6 Security Implications of FlatPages 15.7 Migrations for Sites and Flatpages
15.7.1 The Core App 15.7.2 Data Migration for Site 15.7.3 Data Migration for FlatPage
15.8 Putting It All Together
16. Serving Static Content with Django
16.1 Introduction 16.2 Adding Static Content for Apps 16.3 Adding Static Content for the Project 16.4 Integrating Real CSS Content 16.5 Putting It All Together
17. Understanding Generic Class-Based Views
17.1 Introduction 17.2 Building Generic Object Detail Pages
17.2.1 Converting to Class-Based Views 17.2.2 Generic Behavior 17.2.3 Anticipating Behavior Overrides 17.2.4 Switching to Django’s GCBV
17.3 Why Use Classes for Generic Views? 17.4 Building Generic Object Create Pages 17.5 Replacing CBVs with GCBVs
17.5.1 Organizer Views 17.5.2 Blog Views 17.5.3 Returning to Redirection 17.5.4 Replacing Flatpages 17.5.5 Overriding Methods (in NewsLinkDelete)
17.6 Forgoing GCBVs 17.7 Adding Behavior with GCBV
17.7.1 Yearly Archive for Post 17.7.2 Monthly Archive for Post 17.7.3 Creating ArchiveIndexView
17.8 Putting It All Together
18. Advanced Generic Class-Based View Usage
18.1 Introduction 18.2 Rapid Review of GCBV 18.3 Globally Setting Template Suffix for Update Views 18.4 Generating Pagination Links
18.4.1 StartupList Pagination 18.4.2 TagList Pagination 18.4.3 Pagination Links 18.4.4 Extending Pagination Behavior Further
18.5 Re-creating PostDetail with DateDetailView 18.6 Switching to GCBVs with PostGetMixin in Post Views 18.7 Making PostGetMixin Generic 18.8 Fixing NewsLink URL Patterns and Form Behavior
18.8.1 NewsLink URL patterns 18.8.2 Automating Startup Selection in NewsLink Forms
18.9 Putting It All Together
19. Basic Authentication
19.1 Introduction 19.2 Configuring Logging 19.3 Sessions and Cookies 19.4 auth App Anatomy: The Basics 19.5 Adding Login and Logout Features
19.5.1 User in the Shell 19.5.2 Creating a User App 19.5.3 Using Django’s Views to Make Login and Logout Pages 19.5.4 Post-Authentication Redirection
19.6 Putting It All Together
20. Integrating Permissions
20.1 Introduction 20.2 Understanding contenttypes and Generic Relations 20.3 auth App Anatomy: Permission and Group Models
20.3.1 Permissions in the Shell 20.3.2 Groups in the Shell 20.3.3 Object-Level Permissions
20.4 Protecting Views with Permissions
20.4.1 Custom Decorators 20.4.2 Future Posts Mixin
20.5 Conditionally Displaying Template Links 20.6 Displaying Future Posts in the Template 20.7 Putting It All Together
21. Extending Authentication
21.1 Introduction 21.2 auth App Anatomy: Password Views 21.3 Changing Passwords 21.4 Resetting Passwords 21.5 Disabling Accounts 21.6 Creating Accounts
21.6.1 Mixins for Sending and Logging Emails 21.6.2 Creation Form 21.6.3 Views for Creating and Activating Accounts 21.6.4 Account Creation Templates 21.6.5 Resending Activation
21.7 URL Cleanup 21.8 Anatomy of the App: Full Dissection 21.9 Putting It All Together
22. Overriding Django’s Authentication with a Custom User
22.1 Introduction 22.2 Creating a User Profile
22.2.1 The Profile Model 22.2.2 Implementing ProfileDetail 22.2.3 Profile Update 22.2.4 Public Profile
22.3 Custom User
22.3.1 Creating a Custom Manager for User 22.3.2 Swapping the User Model 22.3.3 Integrating Forms and Templates
22.4 Data Migrations 22.5 Adding an Author to Blog Posts 22.6 Putting It All Together
23. The Admin Library
23.1 Introduction 23.2 A First Look 23.3 Modifying the Admin Controls for Blog Posts
23.3.1 Configuring the List of Post Objects 23.3.2 Configuring the Add and Edit Pages 23.3.3 Adding Extra Information to the List View
23.4 Configuring the Admin for the User Model
23.4.1 Configuring the List Page 23.4.2 Configuring the Add and Edit Pages 23.4.3 Adding a Change Password Page 23.4.4 Adding Profile to UserAdmin Thanks to Inline Instances
23.5 Creating Admin Actions 23.6 Putting It All Together
III: Advanced Core Features
24. Creating Custom Managers and Querysets
24.1 Introduction to Part III 24.2 Introduction to Chapter 24 24.3 Custom Managers and Querysets 24.4 Fixtures 24.5 Management Commands
24.5.1 The createtag Management Command 24.5.2 The createuser and createsuperuser Commands
24.6 Putting It All Together
25. Handling Behavior with Signals
25.1 Introduction 25.2 Apps and AppConfig 25.3 Signals
25.3.1 Informing the User of Login/Logout Actions 25.3.2 Automatically Assigning Tag Objects to Post Instances
25.4 Putting It All Together
26. Optimizing Our Site for Speed
26.1 Introduction 26.2 Profiling 26.3 Limiting Database Queries
26.3.1 Understanding the Problem 26.3.2 Template Short-Circuiting 26.3.3 Caching Properties 26.3.4 Caching Template Variables 26.3.5 Introspecting Optimization in the Shell 26.3.6 Using Migrations to Learn about Optimization 26.3.7 Optimizing Views with Related Content 26.3.8 Optimizing Manager and QuerySet Classes Directly 26.3.9 Optimizing Admin Pages
26.4 Changing Database Behavior Internally 26.5 Changing Performance Globally
26.5.1 Caching Template Files 26.5.2 Caching Entire Webpages 26.5.3 Development
26.6 Putting It All Together
27. Building Custom Template Tags
27.1 Introduction 27.2 Custom Template Filters 27.3 Custom Template Tags
27.3.1 Displaying Related Posts 27.3.2 Displaying Create and Update Forms 27.3.3 Displaying Delete Confirmation Forms 27.3.4 Listing the Latest Blog Posts
27.4 Putting It All Together
28. Adding RSS and Atom Feeds and a Sitemap
28.1 Introduction 28.2 RSS and Atom Feeds 28.3 Sitemaps
28.3.1 Post Sitemap 28.3.2 Tag Sitemap 28.3.3 Startup Sitemap 28.3.4 Blog Post Archive Sitemap 28.3.5 Other Pages Sitemap
28.4 Putting It All Together
29. Deploy!
29.1 Introduction: Understanding Modern Deployments 29.2 Preparing for Deployment
29.2.1 Creating Error Pages 29.2.2 Deployment Tools 29.2.3 Preparing Django Settings 29.2.4 Running Django’s Development Server 29.2.5 Running Foreman’s Server 29.2.6 Checking Our Production Settings
29.3 Deploying to Heroku 29.4 Adding Backing Services
29.4.1 Logging with Papertrail 29.4.2 Sending Emails with Postmark 29.4.3 Caching with Memcache
29.5 Putting It All Together
30. Starting a New Project Correctly
30.1 Introduction 30.2 Preparing a Project
30.2.1 Project Specification 30.2.2 Picking Third-Party Apps 30.2.3 The User Model
30.3 Building the Project
30.3.1 Testing 30.3.2 PostgreSQL 30.3.3 Starting with Generic Views 30.3.4 Reconsidering Reverse Methods 30.3.5 Optimization 30.3.6 Building REST APIs
30.4 The Road Ahead
IV: Appendixes
A. HTTP B. Python Primer
B.1 Decorators B.2 Multiple Inheritance
C. Relational Database Basics D. Security Basics E. Regular Expressions F. Compilation Basics G. Installing Python, Django, and Your Tools
G.1 Package Management G.2 Version Control G.3 Python G.4 Virtual Environments G.5 Django G.6 Syntax Tools and Testing
Index Code Snippets
  • ← Prev
  • Back
  • Next →
  • ← Prev
  • Back
  • Next →

Chief Librarian: Las Zenow <zenow@riseup.net>
Fork the source code from gitlab
.

This is a mirror of the Tor onion service:
http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion