Getting started with Django


Getting started with Django
eBook: $16.99
Formats: PDF, PacktLib, ePub and Mobi formats
$14.45
save 15%!
Print + free eBook + free PacktLib access to the book: $39.98    Print cover: $22.99
$37.44
save 6%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Get to know MVC pattern and the structure of Django
  • Create your first webpage with Django mechanisms
  • Enable user interaction with forms
  • Program extremely rapid forms with Django features.
  • Explore the best practices to develop applications of a superior quality

Book Details

Language : English
Paperback : 172 pages [ 235mm x 191mm ]
Release Date : June 2014
ISBN : 1783983701
ISBN 13 : 9781783983704
Author(s) : Samuel Dauzon
Topics and Technologies : All Books, Web Development, Open Source


Table of Contents

Preface
Chapter 1: Django's Position on the Web
Chapter 2: Creating a Django Project
Chapter 3: Hello World! with Django
Chapter 4: Working with Templates
Chapter 5: Working with Models
Chapter 6: Getting a Model's Data with Querysets
Chapter 7: Working with Django Forms
Chapter 8: Raising Your Productivity with CBV
Chapter 9: Using Sessions
Chapter 10: The Authentication Module
Chapter 11: Using AJAX with Django
Chapter 12: Production with Django
Appendix: Cheatsheet
Index

  • Chapter 2: Creating a Django Project
    • Installing Python 3
      • Installing Python 3 for Windows
      • Installing Python 3 for Linux
      • Installing Python 3 for Mac OS
    • Installing setuptools
      • Installing setuptools for Windows
      • Installing setuptools for Linux
      • Installing setuptools for Mac OS
    • Installing PIP
      • Installing PIP for Windows
      • Installing PIP for Linux
      • Installing PIP for Mac OS
    • Installing Django
      • Installing Django for Windows
      • Installing Django for Linux
      • Installing Django for Mac OS
    • Starting your project with Django
    • Creating an application
    • Configuring the application
    • Summary
  • Chapter 3: Hello World! with Django
    • Routing in Django
    • Regular expressions
      • The uninterpreted characters
      • The beginning and the end of the line
      • The any character regular expression
      • Character classes
      • Validating the number of characters
    • Creating our first URL
    • Creating our first view
    • Testing our application
    • Summary
  • Chapter 4: Working with Templates
    • Displaying Hello world! in a template
    • Injecting the data from the view to the template
    • Creating dynamic templates
    • Integrating variables in templates
      • Conditional statements
      • Looping in a template
    • Using filters
      • The upper and lower filters
        • The lower filter
        • The upper filter
      • The capfirst filter
      • The pluralize filter
      • The escape and safe to avoid XSS filters
      • The linebreaks filter
      • The truncatechars filter
    • Creating DRY URLs
    • Extending the templates
    • Using static files in templates
    • Summary
  • Chapter 5: Working with Models
    • Databases and Django
    • Migrations with South
      • Installing South
      • Using the South extension
    • Creating simple models
      • The UserProfile model
      • The Project model
    • The relationship between the models
      • Creating the task model with relationships
    • Extending models
    • The admin module
      • Installing the module
      • Using the module
    • Advanced usage of models
      • Using two relationships for the same model
      • Defining the str method
    • Summary
  • Chapter 6: Getting a Model's Data with Querysets
    • The persisting model's data on the database
      • Filling a model and saving it in the database
    • Getting data from the database
      • Getting multiple records
      • Getting only one record
      • Getting a model instance from the queryset instance
    • Using the get parameter
    • Saving the foreign key
    • Updating records in the database
      • Updating a model instance
      • Updating multiple records
    • Deleting a record
    • Getting linked records
    • Advanced usage of the queryset
      • Using an OR operator in a queryset
      • Using the lower and greater than lookups
      • Performing an exclude query
      • Making a raw SQL query
    • Summary
  • Chapter 7: Working with Django Forms
    • Adding a developer without using Django forms
      • Template of an HTML form
      • The view using the POST data reception
    • Adding a developer with Django forms
      • CSRF protection
      • The view with a Django form
      • Template of a Django form
    • The form based on a model
      • The supervisor creation form
    • Advanced usage of Django forms
      • Extending the validation form
      • Customizing the display of errors
      • Using widgets
      • Setting initial data in a form
        • When instantiating the form
        • When defining fields
    • Summary
  • Chapter 8: Raising Your Productivity with CBV
    • The CreateView CBV
      • An example of minimalist usage
    • Working with ListView
      • An example of minimalist usage
      • Extending ListView
    • The DetailView CBV
      • An example of minimalist usage
      • Extending DetailView
    • The UpdateView CBV
      • An example of minimalist usage
      • Extending the UpdateView CBV
    • The DeleteView CBV
    • Going further by extending the CBV
      • Using a custom class CBV update
    • Summary
  • Chapter 9: Using Sessions
    • Creating and getting session variables
      • An example – showing the last task consulted
    • About session security
    • Summary
  • Chapter 10: The Authentication Module
    • How to use the authentication module
      • Configuring the Django application
      • Editing the UserProfile model
    • Adding a user
    • Login and logout pages
    • Restricting access to the connected members
      • Restricting access to views
      • Restricting access to URLs
    • Summary
  • Chapter 11: Using AJAX with Django
    • Working with jQuery
    • jQuery basics
      • CSS selectors in jQuery
      • Getting back the HTML content
      • Setting HTML content in an element
      • Looping elements
      • Importing the jQuery library
    • Working with AJAX in the task manager
    • Summary
  • Chapter 12: Production with Django
    • Completing the development
    • Selecting the physical server
    • Selecting the server software
    • Selecting the server database
    • Deploying the Django website
      • Installing PIP and Python 3
      • Installing PostgreSQL
      • Installing virtualenv and creating a virtual environment
    • Installing Django, South, Gunicorn, and psycopg2
      • Configuring PostgreSQL
      • Adaptation of Work_manager to production
      • Initial South migration
      • Using Gunicorn
      • Starting Nginx
    • Summary
  • Appendix: Cheatsheet
    • The field types in models
      • The numerical field type
      • The string field type
      • The temporal field type
      • Other types of fields
      • Relationship between models
      • The model meta attributes
      • Options common to all fields of models
    • The form fields
      • Common options for the form fields
      • The widget form
      • Error messages (forms and models)
    • The template language
      • Template tags
        • Loops in dictionaries
        • Conditional statements
      • The template filters
      • The queryset methods

 

Samuel Dauzon

Samuel Dauzon is a web developer. After two years of studying networks and their administration, he decided to head for development. He regularly tries out the latest development technologies for his customers. He is interested in software quality and security. He is also interested in web frameworks and has studied Symfony2 and ExtJS. He works primarily on CodeIgniter2 and Django.

He previously worked for CER FRANCE 49 (an accounting firm) for one year, where he created some software that was used internally with the WebDev software. Presently, he works for ILTR, a web development company specializing in ASP, PHP, and CodeIgniter2. For over two years, he has also worked as a freelance web developer (in PHP, Django, and so on).

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 1 submitted: last submission 23 Jul 2014

Errata type: Code | Page number: 29

 

It is given as:

url (r'^$', 'TasksManager.views.index.page),
url (r'^index$', 'TasksManager.views.index.page')

 

This should be:

url (r'^$', 'TasksManager.views.index.page'),
url (r'^index$', 'TasksManager.views.index.page')

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Getting started with Django +    Extending Puppet =
50% Off
the second eBook
Price for both: $22.95

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Utilize the MVC pattern to create web applications
  • Use Django models to store information in the database and generate queries to access a database across models
  • Generate very maintainable forms with Django
  • Quickly develop web pages to create, read, update, and delete data from the model using class-based views
  • Construct users by using an authentication module to restrict access to certain pages
  • Use AJAX with Django
  • Install your website on Linux and access it through the Internet

In Detail

Django is a powerful Python web framework designed for rapid web application development. With the advent of frameworks such as Django, web developers have been forced to adopt MVC architectures and are encouraged to develop quality code. This quality allows several developers to work together easily and reduces the number of bugs due to human errors.

Beginning with the basics of the Web and Django, the book explains the MVC pattern. It then moves on to explain the step-by-step installation of Python, PIP, and Django on Windows, Linux, and Mac OS. Furthermore, you will learn how to create templates, models, forms, and so on. After reading the book, you will be able to quickly create dynamic web applications with AJAX and an admin part.

This book features a step-by-step approach that shows you how to program, create, and improve the quality of web applications using Django, with the help of Python.

Approach

This book features a step-by-step approach that shows you how to program, create, and improve the quality of web applications using Django, with the help of Python.

Who this book is for

This is an ideal book for developers who want to improve the quality and maintenance of their web application, and who already have knowledge of Python and web development.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software