更新时间:2021-07-23 14:32:25
封面
版权页
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files eBooks discount offers and more
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Chapter 1. Getting Started with Django 1.8
Introduction
Working with a virtual environment
Creating a project file structure
Handling project dependencies with pip
Making your code compatible with both Python 2.7 and Python 3
Including external dependencies in your project
Configuring settings for development testing staging and production environments
Defining relative paths in the settings
Creating and including local settings
Setting up STATIC_URL dynamically for Subversion users
Setting up STATIC_URL dynamically for Git users
Setting UTF-8 as the default encoding for MySQL configuration
Setting the Subversion ignore property
Creating the Git ignore file
Deleting Python-compiled files
Respecting the import order in Python files
Creating app configuration
Defining overwritable app settings
Chapter 2. Database Structure
Using model mixins
Creating a model mixin with URL-related methods
Creating a model mixin to handle creation and modification dates
Creating a model mixin to take care of meta tags
Creating a model mixin to handle generic relations
Handling multilingual fields
Using migrations
Switching from South migrations to Django migrations
Changing a foreign key to the many-to-many field
Chapter 3. Forms and Views
Passing HttpRequest to the form
Utilizing the save method of the form
Uploading images
Creating a form layout with django-crispy-forms
Downloading authorized files
Filtering object lists
Managing paginated lists
Composing class-based views
Generating PDF documents
Implementing a multilingual search with Haystack
Chapter 4. Templates and JavaScript
Arranging the base.html template
Including JavaScript settings
Using HTML5 data attributes
Opening object details in a modal dialog
Implementing a continuous scroll
Implementing the Like widget
Uploading images by Ajax
Chapter 5. Custom Template Filters and Tags
Following conventions for your own template filters and tags
Creating a template filter to show how many days have passed since a post was published
Creating a template filter to extract the first media object
Creating a template filter to humanize URLs
Creating a template tag to include a template if it exists
Creating a template tag to load a QuerySet in a template
Creating a template tag to parse content as a template
Creating a template tag to modify request query parameters
Chapter 6. Model Administration
Customizing columns on the change list page
Creating admin actions
Developing change list filters
Customizing default admin settings
Inserting a map into a change form
Chapter 7. Django CMS
Creating templates for Django CMS
Structuring the page menu
Converting an app to a CMS app
Attaching your own navigation
Writing your own CMS plugin
Adding new fields to the CMS page
Chapter 8. Hierarchical Structures
Creating hierarchical categories
Creating a category administration interface with django-mptt-admin
Creating a category administration interface with django-mptt-tree-editor
Rendering categories in a template
Using a single selection field to choose a category in forms
Using a checkbox list to choose multiple categories in forms
Chapter 9. Data Import and Export