You are previewing Web Development with Django Cookbook.
O'Reilly logo
Web Development with Django Cookbook

Book Description

Over 70 practical recipes to create multilingual, responsive, and scalable websites with Django

In Detail

Django is easy to learn and solves all types of web development problems and questions, providing Python developers an easy solution to web-application development. With a wealth of third-party modules available, you'll be able to create a highly customizable web application with this powerful framework.

Web Development with Django Cookbook will guide you through all web development processes with the Django framework. You will get started with the virtual environment and configuration of the project, and then you will learn how to define a database structure with reusable components. Find out how to tweak the administration to make the website editors happy. This book deals with some important third-party modules necessary for fully equipped web development.

What You Will Learn

  • Configure your Django project the right way
  • Build a database structure out of reusable model mixins
  • Manage hierarchical structures with MPTT
  • Play nicely with JavaScript in responsive templates
  • Create handy template filters and tags that you can reuse in every project
  • Master the configuration of contributed administration
  • Extend Django CMS with your own functionality
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Web Development with Django Cookbook
      1. Table of Contents
      2. Web Development with Django Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Getting Started with Django 1.6
        1. Introduction
        2. Working with a virtual environment
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Creating a project file structure
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Handling project dependencies with pip
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Including external dependencies in your project
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Defining relative paths in the settings
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Setting up STATIC_URL dynamically for Subversion users
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        8. Setting up STATIC_URL dynamically for Git users
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        9. Creating and including local settings
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        10. Setting UTF-8 as the default encoding for MySQL configuration
          1. Getting ready
          2. How to do it...
          3. How it works...
        11. Setting the Subversion ignore property
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        12. Creating the Git ignore file
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        13. Deleting Python-compiled files
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        14. Importing an order in Python files
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        15. Defining overwritable app settings
          1. Getting ready
          2. How to do it...
          3. How it works...
      9. 2. Database Structure
        1. Introduction
        2. Using model mixins
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Creating a model mixin with URL-related methods
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Creating a model mixin to handle creation and modification dates
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Creating a model mixin to take care of meta tags
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Creating a model mixin to handle generic relations
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Handling multilingual fields
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Using South migrations
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Changing a foreign key to the many-to-many field with South
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      10. 3. Forms and Views
        1. Introduction
        2. Passing HttpRequest to the form
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Utilizing the save method of the form
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Uploading images
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more
          5. See also
        5. Creating a form layout with django-crispy-forms
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Filtering object lists
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Managing paginated lists
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        8. Composing class-based views
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There is more...
          5. See also
        9. Generating PDF documents
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      11. 4. Templates and JavaScript
        1. Introduction
        2. Arranging the base.html template
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Including JavaScript settings
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Using HTML5 data attributes
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Opening object details in a pop up
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Implementing a continuous scroll
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Implementing the Like widget
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        8. Uploading images by Ajax
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      12. 5. Custom Template Filters and Tags
        1. Introduction
        2. Following conventions for your own template filters and tags
          1. How to do it...
          2. See also
        3. Creating a template filter to show how many days have passed
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Creating a template filter to extract the first media object
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Creating a template filter to humanize URLs
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Creating a template tag to include a template if it exists
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Creating a template tag to load a QuerySet in a template
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        8. Creating a template tag to parse content as a template
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        9. Creating a template tag to modify request query parameters
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      13. 6. Model Administration
        1. Introduction
        2. Customizing columns in the change list page
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Creating admin actions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Developing change list filters
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Exchanging administration settings for external apps
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Inserting a map into a change form
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      14. 7. Django CMS
        1. Introduction
        2. Creating templates for Django CMS
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Structuring the page menu
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Converting an app to a CMS app
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Attaching your own navigation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Writing your own CMS plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Adding new fields to the CMS page
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      15. 8. Hierarchical Structures
        1. Introduction
        2. Creating hierarchical categories
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Creating a category administration interface with django-mptt-admin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Creating a category administration interface with django-mptt-tree-editor
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Rendering categories in a template
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Using a single selection field to choose a category in forms
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Using a checkbox list to choose multiple categories in forms
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      16. 9. Data Import and Export
        1. Introduction
        2. Importing data from a local CSV file
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Importing data from a local Excel file
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Importing data from an external JSON file
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Importing data from an external XML file
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Creating filterable RSS feeds
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Using Tastypie to provide data to third parties
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      17. 10. Bells and Whistles
        1. Introduction
        2. Using the Django shell
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. The monkey patching slugification function
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. The monkey patching model administration
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Toggling Debug Toolbar
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Using ThreadLocalMiddleware
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Caching the method value
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        8. Getting detailed error reporting via e-mail
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        9. Deploying on Apache with mod_wsgi
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Creating and using the Fabric deployment script
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      18. Index