Contents

About the Author

About the Technical Reviewer

Introduction

imageCHAPTER 1    Welcome to Django

What's a Web Framework and Why Should I Want One?

Saying Hello to Django

Saying Hello to Python

Installing Django

Taking Your First Steps with Django

Exploring Your Django Project

Looking Ahead

imageCHAPTER 2    Your First Django Site: A Simple CMS

Configuring Your First Django Project

Putting Together the CMS

Introducing the Django Template System

Looking Ahead

imageCHAPTER 3    Customizing the Simple CMS

Adding Rich-Text Editing

Adding a Search System to the CMS

Improving the Search View

Improving the Search Function with Keywords

Looking Ahead

imageCHAPTER 4    A Django-Powered Weblog

Compiling a Feature Checklist

Writing a Django Application

Projects vs. Applications

Standalone and Coupled Applications

Creating the Weblog Application

Designing the Models

Building the Entry Model

Basic Fields

Slugs, Useful Defaults, and Uniqueness Constraints

Authors, Comments, and Featured Entries

Different Types of Entries

Categorizing and Tagging Entries

Writing Entries Without Writing HTML

Finishing Touches

The Weblog Models So Far

Writing the First Views

Using Django's Generic Views

Decoupling the URLs

Looking Ahead

imageCHAPTER 5    Expanding the Weblog

Writing the Link Model

Views for the Link Model

Setting Up Views for Categories

Using Generic Views (Again)

Views for Tags

Cleaning Up the URLConf Module

Handling Live Entries

Looking Ahead

imageCHAPTER 6    Templates for the Weblog

Dealing with Repetitive Elements: The Power of Inheritance

How Template Inheritance Works

Limits of Template Inheritance

Defining the Base Template for the Blog

Setting Up Section Templates

Displaying Archives of Entries

Entry Index

Yearly Archive

Monthly and Daily Archives

Entry Detail

Defining Templates for Other Types of Content

Extending the Template System with Custom Tags

How a Django Template Works

A Simple Custom Tag

Writing a More Flexible Tag with Arguments

Writing the LatestContentNode

Registering and Using the New Tag

Looking Ahead

imageCHAPTER 7    Finishing the Weblog

Comments and django.contrib.comments

Implementing Model Inheritance and Abstract Models

Installing the Comments Application

Performing Basic Setup

Retrieving Lists of Comments for Display

Moderating Comments

Using Signals and the Django Dispatcher

Building the Automatic Comment Moderator

Adding Akismet Support

Sending E-mail Notifications

Using Django's Comment-Moderation Features

Adding Feeds

Creating the LatestEntriesFeed Class

Generating Entries by Category: A More Complex Feed Example

Looking Ahead

imageCHAPTER 8    A Social Code-Sharing Site

Compiling a Feature Checklist

Setting Up the Application

Building the Initial Models

The Language Model

The Snippet Model

Testing the Application

Building Initial Views for Snippets and Languages

CSS for pygments Syntax Highlighting

Views for Languages

An Advanced View: Top Authors

Improving the View of Top Authors

Adding a top_languages View

Looking Ahead

imageCHAPTER 9    Form Processing in the Code-Sharing Application

A Brief Tour of Django's Form System

A Simple Example

Validating the Username

Validating the Password

Creating the New User

How Form Validation Works

Processing the Form

Writing a Form for Adding Code Snippets

Writing a View to Process the Form

Writing the Template to Handle the add_snippet View

Automatically Generating the Form from a Model Definition

Simplifying Templates That Display Forms

Editing Snippets

Looking Ahead

imageCHAPTER 10  Finishing the Code-Sharing Application

Bookmarking Snippets

Adding Basic Bookmark Views

Creating a New Template Tag: {% if_bookmarked %}

Parsing Ahead in a Django Template

Resolving Variables Inside a Template Node

Using RequestContext to Automatically Populate Template Variables

Adding the User Rating System

Rating Snippets

Adding an {% if_rated %} Template Tag

Retrieving a User's Rating

Looking Ahead

imageCHAPTER 11  Practical Development Techniques

Using Version-Control Systems to Track Your Code

A Simple Example

Version-Control Tools and Hosting Options

Choosing and Using a VCS

Using Isolated Python Environments to Manage Software

Using Build Tools

Using a Deployment Tool

Simplifying Your Django Development Process

Living Without Projects

Using Relative Paths in Settings

Dealing with Settings That Change for Different Environments

Unit-Testing Your Applications

Looking Ahead

imageCHAPTER 12  Writing Reusable Django Applications

One Thing at a Time

Staying Focused

Advantages of Tightly Focused Applications

Developing Multiple Applications

Drawing the Lines Between Applications

Splitting Up the Code-Sharing Application

Building for Flexibility

Flexible Form Handling

Flexible Template Handling

Flexible Post-Form Processing

Flexible URL Handling

Taking Advantage of Django's APIs

Staying Generic

Distributing Django Applications

Python Packaging Tools

Writing a setup.py Script with distutils

Standard Files to Include in a Package

Documenting an Application

Looking Ahead

imageIndex

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset