Web Development with Django Cookbook Table of Contents Web Development with Django Cookbook Credits About the Author About the Reviewers www.PacktPub.com Support files, eBooks, discount offers, and more Why Subscribe? Free Access for Packt account holders Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Errata Piracy Questions Getting Started with Django 1.6 Introduction Working with a virtual environment Getting ready How to do it… How it works… See also Creating a project file structure Getting ready How to do it… How it works… See also Handling project dependencies with pip Getting ready How to do it… How it works… There’s more… See also Including external dependencies in your project Getting ready How to do it… How it works… See also Defining relative paths in the settings Getting ready How to do it… How it works… See also Setting up STATIC_URL dynamically for Subversion users Getting ready How to do it… How it works… See also Setting up STATIC_URL dynamically for Git users Getting ready How to do it… How it works… See also Creating and including local settings Getting ready How to do it… How it works… See also Setting UTF-8 as the default encoding for MySQL configuration Getting ready How to do it… How it works… Setting the Subversion ignore property Getting ready How to do it… How it works… See also Creating the Git ignore file Getting ready How to do it… How it works… See also Deleting Python-compiled files Getting ready How to do it… How it works… See also Importing an order in Python files Getting ready How to do it… How it works… There’s more… See also Defining overwritable app settings Getting ready How to do it… How it works… Database Structure Introduction Using model mixins Getting ready How to do it… How it works… There’s more… See also Creating a model mixin with URL-related methods Getting ready How to do it… How it works… See also Creating a model mixin to handle creation and modification dates Getting ready How to do it… How it works… See also Creating a model mixin to take care of meta tags Getting ready How to do it… How it works… See also Creating a model mixin to handle generic relations Getting ready How to do it… How it works… See also Handling multilingual fields Getting ready How to do it… How it works… Using South migrations Getting ready How to do it… How it works… There’s more… See also Changing a foreign key to the many-to-many field with South Getting ready How to do it… How it works… See also Forms and Views Introduction Passing HttpRequest to the form Getting ready How to do it… How it works… See also Utilizing the save method of the form Getting ready How to do it… How it works… See also Uploading images Getting ready How to do it… How it works… There’s more See also Creating a form layout with django-crispy-forms Getting ready How to do it… How it works… There’s more… See also Filtering object lists Getting ready How to do it… How it works… See also Managing paginated lists Getting ready How to do it… How it works… See also Composing class-based views Getting ready How to do it… How it works… There is more… See also Generating PDF documents Getting ready How to do it… How it works… See also Templates and JavaScript Introduction Arranging the base.html template Getting ready How to do it… How it works… See also Including JavaScript settings Getting ready How to do it… How it works… See also Using HTML5 data attributes Getting ready How to do it… How it works… See also Opening object details in a pop up Getting ready How to do it… How it works… See also Implementing a continuous scroll Getting ready How to do it… How it works… See also Implementing the Like widget Getting ready How to do it… How it works… See also Uploading images by Ajax Getting ready How to do it… How it works… I images uploading / Uploading images, Getting ready, How it works…, There’s more uploading, by Ajax / Uploading images by Ajax, How to do it…, How it works… include_self parameter about / How it works… Internet Movie Database URL / Implementing a continuous scroll items method / How it works… J JavaScript settings including / Including JavaScript settings, How to do it…, How it works… creating / How to do it…, How it works… jScroll plugin URL / Getting ready L layout property / How to do it… level field about / How it works… lft field about / How it works… Like implementing / Implementing the Like widget, Getting ready, How to do it…, How it works… liking / How to do it… limit_object_choices_to parameter / How it works… link method / How it works… local CSV file data, importing from / Importing data from a local CSV file, How to do it…, How it works… local Excel file data, importing from / Importing data from a local Excel file, How to do it…, How it works… local function / How it works… local settings creating / Creating and including local settings, How it works… including / Creating and including local settings, How it works… loggers about / How it works… logging URL / How it works… M many-to-many field foreign key, changing to / Changing a foreign key to the many-to-many field with South, How to do it…, How it works… map inserting, into change form / Inserting a map into a change form, How to do it…, How it works… mark_safe function / How it works… Mercury Skate / How it works… meta tags model mixin, creating for / Creating a model mixin to take care of meta tags, How it works… method attribute / How it works… method value caching / Caching the method value model creation model mixin, creating for / Creating a model mixin to handle creation and modification dates, How it works… model mixin creating, with URL-related methods / Creating a model mixin with URL-related methods, How to do it…, How it works… creating, for handling creation / Creating a model mixin to handle creation and modification dates, How it works… creating, for handling modification dates / Creating a model mixin to handle creation and modification dates, How it works… creating, for meta tags / Creating a model mixin to take care of meta tags, How it works… creating, for handling generic relations / Creating a model mixin to handle generic relations, How to do it…, How it works… model mixins using / Using model mixins, How to do it…, There’s more… modification dates model mixin, creating for / Creating a model mixin to handle creation and modification dates, How it works… Modified Preorder Tree Traversal (MPTT) about / Introduction mod_wsgi Apache, deploying with / Deploying on Apache with mod_wsgi, How to do it…, How it works…, There’s more… Monkey patching about / The monkey patching slugification function monkey patching model administration about / The monkey patching model administration, How to do it…, How it works…, There’s more… monkey patching slugification function about / The monkey patching slugification function, How it works… multilingual fields handling / Handling multilingual fields, How to do it…, How it works… advantages / Handling multilingual fields multiple categories, forms selecting, checkbox list used / Using a checkbox list to choose multiple categories in forms, How to do it…, How it works… MySQLdb / Working with a virtual environment N navigation attaching / Attaching your own navigation, How to do it…, How it works… NavigationNode class about / How it works… new fields adding, to CMS page / Adding new fields to the CMS page, How to do it…, How it works… O obj dictionary / How it works… object details opening, in pop up / Opening object details in a pop up, How to do it…, How it works… object lists filtering / Filtering object lists, How to do it…, How it works… object_relation_mixin_factory function / How it works… object_relation_mixin_factory mixin / How it works… on page load / How to do it… order importing, in Python files / Importing an order in Python files, How it works… overwritable app settings defining / Defining overwritable app settings, How to do it…, How it works… P tag about / How it works… tag about / How it works… tag about / How it works… PageExtension class / How it works… page menu structuring / Structuring the page menu, How to do it… paginated lists managing / Managing paginated lists, How to do it…, How it works… PDF documents generating / Generating PDF documents, Getting ready, How to do it…, How it works… Pillow / Working with a virtual environment pip project dependencies, handling with / Handling project dependencies with pip, How it works… URL / There’s more… Pisa xhtml2pdf library about / Generating PDF documents pop up object details, opening in / Opening object details in a pop up, How to do it…, How it works… pprint function / How to do it… production function / How to do it… project external dependencies, including / Including external dependencies in your project, How to do it…, How it works… project dependencies handling, with pip / Handling project dependencies with pip, How it works… project file structure creating / Creating a project file structure, How to do it… prompt function / How it works… Python compiled files deleting / Deleting Python-compiled files, How it works… Python files order, importing in / Importing an order in Python files, How it works… Python Image Library / Working with a virtual environment Python Package Index (PyPI) / Including external dependencies in your project {% parse %} template tag / How it works… Q QueryDict objects URL / How it works… QuerySet, template loading, template tag created for / Creating a template tag to load a QuerySet in a template, How to do it…, How it works… queryset parameter / How it works… R relative paths defining, in settings / Defining relative paths in the settings, Getting ready render method / How it works…, How it works… REQUEST object about / How it works… request query parameters modifying, template tag created to / Creating a template tag to modify request query parameters, How to do it… requests.get method / How it works… resource_name parameter / How it works… rght field about / How it works… run function / How it works… Ryno / How it works… S save() method / How it works… save method utilizing, of form / Utilizing the save method of the form, How to do it…, How it works… scp command / How it works… selected dictionary about / How it works… single selection field used, for selecting category in forms / Using a single selection field to choose a category in forms, How it works… slugify function / The monkey patching slugification function South migrations using / Using South migrations, How to do it…, How it works… src attribute about / How it works… staging function / How to do it… STATIC_URL setting up, for Subversion users / Setting up STATIC_URL dynamically for Subversion users, How it works… setting up, for Git users / Setting up STATIC_URL dynamically for Git users, How it works… Submit object / How it works… Subversion ignore property setting / Setting the Subversion ignore property, How it works… Subversion users STATIC_URL, setting up for / Setting up STATIC_URL dynamically for Subversion users, How it works… sudo function / How it works… T tags conventions, following for / Following conventions for your own template filters and tags, How to do it… Tastypie used, for providing data to third parties / Using Tastypie to provide data to third parties, How to do it…, How it works… template including, for template tag creation / Creating a template tag to include a template if it exists, How to do it…, How it works…, There’s more… categories, rendering in / Rendering categories in a template, How it works… template filter creating, for keeping track of date / Creating a template filter to show how many days have passed, How it works… creating, for extracting first media object / Creating a template filter to extract the first media object, How it works… creating, for humanizing URLs / Creating a template filter to humanize URLs, How it works… template filters conventions, following for / Following conventions for your own template filters and tags, How to do it… templates creating, for Django CMS / Creating templates for Django CMS, How to do it…, How it works… template tag creating, for including template / Creating a template tag to include a template if it exists, How to do it…, How it works…, There’s more… creating, for loading QuerySet in template / Creating a template tag to load a QuerySet in a template creating, for loading QuerySet / How to do it…, How it works… creating, for parsing content as template / Creating a template tag to parse content as a template, How it works… creating, for modifying request query parameters / Creating a template tag to modify request query parameters, How to do it… third parties data providing, Tastypie used / Using Tastypie to provide data to third parties, How to do it…, How it works… ThreadLocalMiddleware using / Using ThreadLocalMiddleware, How to do it…, How it works… title method / How it works… tree view / How it works… U Uni-Form about / Creating a form layout with django-crispy-forms unliking / How to do it… URL-related methods model mixin, creating with / Creating a model mixin with URL-related methods, How to do it…, How it works… UrlMixin class / How it works… URLs humanizing, for creating template filter / Creating a template filter to humanize URLs, How it works… UTF-8 setting, as default encoding / Setting UTF-8 as the default encoding for MySQL configuration, How it works… UTF-8, default encoding setting, for MySQL configuration / Setting UTF-8 as the default encoding for MySQL configuration, How it works… V Virtualenv / Working with a virtual environment virtual environment working with / Working with a virtual environment, How it works… Virtualmin URL / Deploying on Apache with mod_wsgi instructions, URL / Getting ready X xlrd library / How it works… XML endpoint URL / Getting ready XPath syntax tag / How it works… * / How it works… / How it works… // / How it works… / How it works… [@attrib] / How it works… [@attrib=*value*] / How it works… [tag] / How it works… [position] / How it works… ... Web Development with Django Cookbook Table of Contents Web Development with Django Cookbook Credits About the Author About the Reviewers www.PacktPub.com... How to do it How it works… There’s more… See also Index Web Development with Django Cookbook Web Development with Django Cookbook Copyright © 2014 Packt Publishing All rights reserved No part of this book may be reproduced, stored in a retrieval system,... Getting Started with Django 1.6 Introduction Working with a virtual environment Getting ready How to do it How it works… See also Creating a project file structure Getting ready How to do it How it works…