Getting started with Django : develop simple web applications with the powerful Django framework 9781783983704, 1783983701, 9781783983711, 178398371X, 0123456789

This book features a step-by-step approach that shows you how to program, create, and improve the quality of web applica

837 82 413KB

English Pages 172 Year 2014

Report DMCA / Copyright

DOWNLOAD FILE

Getting started with Django : develop simple web applications with the powerful Django framework
 9781783983704, 1783983701, 9781783983711, 178398371X, 0123456789

Table of contents :
Content: Cover
Copyright
Credits
About the Author
About the Reviewers
www.PacktPub.com
Table of Contents
Preface
Chapter 1: Django's Position on the Web
From Web 1.0 to Web 2.0
Web 1.0
Web 2.0
What is Django?
Django --
a web framework
The MVC framework
Why use Django?
Summary
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 WindowsInstalling 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
The character classes
Validating the number of characters
Creating our first URL
Creating our first view. Testing our applicationSummary
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 DjangoMigrations 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 recordsGetting 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.

Polecaj historie