Pro Django

The Expert's Voice in Web Development

Marty Alchin

Publisher: Apress, 2009, 299 pages

ISBN: 1-4302-1047-8

Keywords: Python, Web Programming

Last modified: Aug. 15, 2009, 1:15 a.m.

Django is the leading Python web application development framework. Learn how to leverage the Django web framework to its full potential in this advanced tutorial and reference. Endorsed by Django, Pro Django more or less picks up where The Definitive Guide to Django left off and examines in greater detail the unusual and complex problems that Python web application developers can face and how to solve them.

  • Provides in–depth information about advanced tools and techniques available in every Django installation
  • Runs the gamut from the theory of Django’s internal operations to actual code that solves real–world problems for high–volume environments
  • Goes above and beyond other books, leaving the basics behind
  • Shows how Django can do things even its core developers never dreamed possible

What you’ll learn

  • See how to use Django’s models, views, forms, and templates.
  • Handle HTTP and customizing back ends.
  • Use Django’s common tooling.
  • Employ Django in various environments.
  • Build a business software suite for use in the corporate world.
  • Make this code reusable—even distributable.

Who is this book for?

This book is for companies looking for a framework capable of supporting enterprise needs, as well as advanced Python or web developers looking to solve unusual, complex problems.

  • Chapter 1 Understanding Django
    • Philosophy
      • Django’s Interpretation of the MVC Pattern
      • Loose Coupling
      • Don’t Repeat Yourself (DRY)
      • A Focus on Readability
      • Failing Loudly
    • Community
      • Management of the Framework
      • News and Resources
      • Reusable Applications
      • Getting Help
    • Now What?
  • Chapter 2 Django Is Python
    • How Python Builds Classes
      • Building aClass Programmatically
      • Metaclasses Change It Up
      • Using aBase Class with aMetaclass
      • Declarative Syntax
    • Common Duck-Typing Protocols
      • Callables
      • Dictionaries
      • Files
      • Iterables
      • Sequences
    • Augmenting Functions
      • Excess Arguments
      • Decorators
    • Descriptors
      • __get__(self, instance, owner)
      • __set__(self, instance, value)
      • Keeping Track of Instance Data
    • Introspection
      • Common Class and Function Attributes
      • Identifying Object Types
      • Function Signatures
      • Docstrings
    • Applied Techniques
      • Tracking Subclasses
      • A Simple Plugin Architecture
    • Now What?
  • Chapter 3 Models
    • How Django Processes Model Classes
      • Setting Attributes on Models
    • Getting Information About Models
      • Class Information
      • Field Definitions
      • Primary Key Fields
      • Configuration Options
      • Accessing the Model Cache
    • Using Model Fields
      • Common Field Attributes
      • Common Field Methods
    • Subclassing Fields
      • Deciding Whether to Invent or Extend
      • Performing Actions During Model Registration
      • Altering Data Behavior
      • Controlling Database Behavior
    • Dealing with Files
      • get_directory_name(self)
      • get_filename(self, filename)
      • generate_filename(self, instance, filename)
      • save_form_data(self, instance, data)
      • delete_file(self, instance, sender)
      • attr_class
      • Customizing the File Class
    • Signals
      • class_prepared
      • pre_init and post_init
      • pre_save and post_save
      • pre_delete and post_delete
      • post_syncdb
    • Applied Techniques
      • Loading Attributes on Demand
      • Creating Models Dynamically at Runtime
    • Now What?
  • Chapter 4 URLs and Views
    • URLs
      • Standard URL Configuration
      • Resolving URLs to Views
      • Resolving Views to URLs
    • Views
      • Templates Break It Up a Bit
      • Anatomy of a View
      • Writing Views to Be Generic
      • View Decorators
      • Using an Object As a View
    • Applied Techniques
      • Dual-Format Decorator
    • Now What?
  • Chapter 5 Forms
    • Declaring and Identifying Fields
    • Binding to User Input
      • Validating Input
    • Custom Fields
      • Validation
      • Controlling Widgets
    • Defining HTML Behavior
      • Custom Widgets
      • Customizing Form Markup
      • Accessing Individual Fields
      • Customizing the Display of Errors
    • Applied Techniques
      • Pending and Resuming Forms
    • Now What?
  • Chapter 6 Templates
    • What Makes a Template
      • Exceptions
      • The Process at Large
      • Content Tokens
      • Parsing Tokens into Nodes
      • Template Nodes
      • Rendering Templates
    • Context
      • Simple Variable Resolution
      • Complex Variable Lookup
      • Including Aspects of the Request
    • Retrieving Templates
      • django.template.loader.get_template(template_name)
      • django.template.loader.select_template(template_name_list)
      • Shortcuts to Load and Render Templates
    • Adding Features for Templates
      • Setting Up the Package
      • Variable Filters
      • Template Tags
      • Adding Features to All Templates
    • Applied Techniques
      • Embedding Another Template Engine
      • Enabling User-Submitted Themes
    • Now What?
  • Chapter 7 Handling HTTP
    • Requests and Responses
      • HttpRequest
      • HttpResponse
    • Writing HTTP Middleware
      • MiddlewareClass.process_request(self, request)
      • MiddlewareClass.process_view(self, request, view, args, kwargs)
      • MiddlewareClass.process_response(self, request, response)
      • MiddlewareClass.process_exception(self, request, exception)
      • Deciding Between Middleware and View Decorators
    • HTTP-Related Signals
      • django.core.signals.request_started
      • django.core.signals.request_finished
      • django.core.signals.got_request_exception
    • Applied Techniques
      • Signing and Validating Cookies
    • Now What?
  • Chapter 8 Backend Protocols
    • Database Access
      • django.db.backends
      • Creation of New Structures
      • Introspection of Existing Structures
      • DatabaseClient
      • DatabaseError and IntegrityError
    • Authentication
      • get_user(user_id)
      • authenticate(**credentials)
      • Storing User Information
    • Files
      • The Base File Class
      • Handling Uploads
      • Storing Files
    • Session Management
    • Caching
      • Specifying a Backend
      • Using the Cache Manually
    • Template Loading
      • load_template_source(template_name, template_dirs=None)
      • load_template_source.is_usable
    • Context Processors
    • Applied Techniques
      • Loading Templates Using a Different Engine
      • Scanning Incoming Files for Viruses
    • Now What?
  • Chapter 9 Common Tools
    • Core Exceptions
      • django.core.exceptions.ImproperlyConfigured
      • django.core.exceptions.MiddlewareNotUsed
      • django.core.exceptions.MultipleObjectsReturned
      • django.core.exceptions.ObjectDoesNotExist
      • django.core.exceptions.PermissionDenied
      • django.core.exceptions.SuspiciousOperation
      • django.core.exceptions.ViewDoesNotExist
    • Text Modification
      • get_text_list(items, last_word='or')
      • javascript_quote(s, quote_double_quotes=False)
      • normalize_newlines(text)
      • phone2numeric(phone)
      • recapitalize(text)
      • smart_split(text)
      • truncate_words(s, num)
      • truncate_html_words(s, num)
      • wrap(text, width)
    • Data Structures
      • django.utils.datastructures.MergeDict
      • django.utils.datastructures.MultiValueDict
      • django.utils.datastructures.SortedDict
    • Functional Utilities
      • django.utils.functional.curry
      • django.utils.functional.memoize
      • django.utils.functional.wraps
    • Signals
      • How It Works
      • Defining aSignal
      • Sending aSignal
      • Capturing Return Values
      • Defining aListener.
      • Registering Listeners
      • Forcing Strong References
    • Now What?
  • Chapter 10 Coordinating Applications
    • Contacts
      • contacts.models.Contact
      • contacts.forms.UserEditorForm
      • contacts.forms.ContactEditorForm
      • contacts.views.edit_contact
      • Admin Configuration
      • URL Configuration
    • Real Estate Properties
      • properties.models.Property
      • properties.models.Feature
      • properties.models.PropertyFeature
      • properties.models.InterestedParty
      • Admin Configuration
      • URL Configuration
    • Now What?
  • Chapter 11 Enhancing Applications
    • Recording the Current User
      • The Thread-Local Approach—Useful but Dangerous
      • The Admin Approach
      • Introducing the CurrentUserField
      • Keeping Track of CurrentUserField Instances
      • The CurrentUserMiddleware
      • Performance Considerations
    • Keeping Historical Records
      • Intended Usage
        • Overview of the Process
        • Step 1: Copy the Model
        • Step 2: Register Signal Handlers
        • Step 3: Assign a Manager
    • Now What?
  • Appendix Contributing to Django
    • Reporting a Ticket
    • Supplying a Patch
    • Writing Tests
    • Writing Documentation
    • Development Sprints
    • Publishing Code
    • Releasing an Application

 


Reviews

Pro Django

Reviewed by Roland Buresund

Decent ****** (6 out of 10)

Last modified: Aug. 15, 2009, 1:15 a.m.

A good explanation on how Django works! Excellent coverage of the finer points of the Django Framwork (with some Python thrown in for good measure). This is really for the hard-core Django developer, and not for the first-timer. The only criticism against it is its lack of any self-criticism, which I would have expected from an otherwise very good book.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required