Mastering Django: Core

Book description

Delivers absolutely everything you will ever need to know to become a master Django programmer

About This Book

  • Gain a complete understanding of Django - the most popular, Python-based web framework in the world
  • Gain the skills to successfully designing, developing, and deploying your app
  • This book is packaged with fully described code so you can learn the fundamentals and the advanced topics to get a complete understanding of all of Django's core functions

Who This Book Is For

This book assumes you have a basic understanding of the Internet and programming. Experience with Python or Django would be an advantage, but is not necessary. It is ideal for beginner to intermediate programmers looking for a fast, secure, scalable, and maintainable alternative web development platform to those based on PHP, Java, and dotNET.

What You Will Learn

  • Use Django to access user-submitted form data, validate it, and work with it
  • Get to know advanced URLconf tips and tricks
  • Extend Django's template system with custom code
  • Define models and use the database API to create, retrieve, update, and delete records
  • Fully extend and customize the default implementation as per your project's needs
  • Test and deploy your Django application
  • Get to know more about Django's session, cache Framework, and middleware

In Detail

Mastering Django: Core is a completely revised and updated version of the original Django Book, written by Adrian Holovaty and Jacob Kaplan-Moss - the creators of Django.

The main goal of this book is to make you a Django expert. By reading this book, you'll learn the skills needed to develop powerful websites quickly, with code that is clean and easy to maintain.

This book is also a programmer's manual that provides complete coverage of the current Long Term Support (LTS) version of Django. For developers creating applications for commercial and business critical deployments, Mastering Django: Core provides a complete, up-to-date resource for Django 1.8LTS with a stable code-base, security fixes and support out to 2018.

Style and approach

This comprehensive step-by-step practical guide offers a thorough understanding of all the web development concepts related to Django. In addition to explaining the features of Django, this book provides real-world experience on how these features fit together to build extraordinary apps.

Table of contents

  1. Mastering Django: Core
    1. Mastering Django: Core
    2. Credits
    3. About the Author
    4. www.PacktPub.com
      1. Why subscribe?
    5. Preface
      1. What you need for this book
      2. Who this book is for
      3. Conventions
      4. Reader feedback
      5. Customer support
        1. Errata
        2. Piracy
        3. Questions
    6. 1. Introduction to Django and Getting Started
      1. Introducing Django
        1. Django's history
        2. Installing Django
        3. Installing Python
          1. Python versions
          2. Installation
        4. Installing a Python Virtual Environment
        5. Installing Django
        6. Setting up a database
        7. Starting a project
          1. Django settings
          2. The development server
        8. The Model-View-Controller (MVC) design pattern
      2. What's next?
    7. 2. Views and URLconfs
      1. Your first Django-powered page: Hello World
        1. Your first view
        2. Your first URLconf
        3. Regular expressions
        4. A quick note about 404 errors
        5. A quick note about the site root
        6. How Django processes a request
      2. Your second view: dynamic content
      3. URLconfs and loose coupling
      4. Your third view: dynamic URLs
      5. Django's pretty error pages
      6. What's next?
    8. 3. Templates
      1. Template system basics
      2. Using the template system
        1. Creating template objects
        2. Rendering a template
      3. Dictionaries and contexts
        1. Multiple contexts, same template
        2. Context variable lookup
        3. Method call behavior
        4. How invalid variables are handled
      4. Basic template-tags and filters
        1. Tags
          1. if/else
          2. for
          3. ifequal/ifnotequal
          4. Comments
        2. Filters
      5. Philosophies and limitations
      6. Using templates in views
      7. Template loading
        1. Template directories
      8. render()
      9. Template subdirectories
      10. The include template tag
      11. Template inheritance
      12. What's next?
    9. 4. Models
      1. The "dumb" way to do database queries in views
      2. Configuring the database
      3. Your first app
      4. Defining Models in Python
        1. Your first model
        2. Installing the Model
      5. Basic data access
        1. Adding model string representations
        2. Inserting and updating data
        3. Selecting objects
        4. Filtering data
        5. Retrieving single objects
        6. Ordering data
        7. Chaining lookups
        8. Slicing data
        9. Updating multiple objects in one statement
        10. Deleting objects
      6. What's next?
    10. 5. The Django Admin Site
      1. Using the admin site
        1. Start the development server
        2. Enter the admin site
      2. Adding your models to the admin site
      3. Making fields optional
        1. Making date and numeric fields optional
      4. Customizing field labels
      5. Custom model admin classes
        1. Customizing change lists
        2. Customizing edit forms
      6. Users, groups, and permissions
      7. When and why to use the admin interface-and when not to
      8. What's next?
    11. 6. Forms
      1. Getting data from the Request Object
        1. Information about the URL
        2. Other information about the Request
        3. Information about submitted data
      2. A simple form-handling example
        1. Query string parameters
      3. Improving our simple form-handling example
      4. Simple validation
      5. Making a contact form
        1. Your first form class
      6. Tying form objects into views
      7. Changing how fields are rendered
      8. Setting a maximum length
      9. Setting initial values
      10. Custom validation rules
      11. Specifying labels
      12. Customizing form design
      13. What's next?
    12. 7. Advanced Views and URLconfs
      1. URLconf Tips and Tricks
        1. Streamlining function imports
        2. Special-Casing URLs in debug mode
        3. Named groupsPreview
          1. The matching/grouping algorithm
        4. What the URLconf searches against
        5. Captured arguments are always strings
        6. Specifying defaults for view arguments
      2. Performance
      3. Error handling
      4. Including other URLconfs
        1. Captured parameters
      5. Passing extra options to view functions
        1. Passing extra options to include()
      6. Reverse resolution of URLs
        1. Examples
      7. Naming URL patterns
      8. URL namespaces
        1. Reversing namespaced URLs
        2. URL namespaces and included URLconfs
      9. What's next?
    13. 8. Advanced Templates
      1. Template language review
      2. Requestcontext and context processors
        1. auth
        2. DEBUG
        3. i18n
        4. MEDIA
        5. static
        6. csrf
        7. Request
        8. messages
      3. Guidelines for writing our own context processors
      4. Automatic HTML escaping
        1. How to turn it off
        2. For individual variables
        3. For template blocks
        4. Automatic escaping of string literals in filter arguments
      5. Inside Template loading
        1. The DIRS option
        2. Loader types
          1. Filesystem loader
          2. App directories loader
          3. Other loaders
      6. Extending the template system
        1. Code layout
        2. Creating a template library
      7. Custom template tags and filters
        1. Writing custom template filters
          1. Registering custom filters
          2. Template filters that expect strings
          3. Filters and auto-escaping
          4. Filters and time zones
        2. Writing custom template tags
          1. Simple tags
          2. Inclusion tags
          3. Assignment tags
      8. Advanced custom template tags
        1. A quick overview
        2. Writing the compilation function
        3. Writing the renderer
        4. Auto-escaping Considerations
        5. Thread-safety Considerations
        6. Registering the tag
        7. Passing template variables to The Tag
        8. Setting a variable in the context
          1. Variable scope in context
        9. Parsing until another block tag
        10. Parsing until another block tag, and saving contents
      9. What's next
    14. 9. Advanced Models
      1. Related objects
        1. Accessing ForeignKey values
        2. Accessing many-to-many values
      2. Managers
        1. Adding extra manager methods
        2. Modifying initial manager QuerySets
      3. Model methods
        1. Overriding predefined model methods
      4. Executing raw SQL queries
      5. Performing raw queries
        1. Model table names
        2. Mapping query fields to model fields
        3. Index lookups
        4. Deferring model fields
        5. Adding annotations
        6. Passing parameters into raw()
      6. Executing custom SQL directly
        1. Connections and cursors
        2. Adding extra Manager methods
      7. What's next?
    15. 10. Generic Views
      1. Generic views of objects
      2. Making "friendly" template contexts
      3. Adding extra context
      4. Viewing subsets of objects
      5. Dynamic filtering
      6. Performing extra work
      7. What's next?
    16. 11. User Authentication in Django
      1. Overview
      2. Using the Django authentication system
      3. User objects
        1. Creating superusers
        2. Creating users
        3. Changing passwords
      4. Permissions and authorization
        1. Default permissions
        2. Groups
        3. Programmatically creating permissions
        4. Permission caching
      5. Authentication in web requests
        1. How to log a user in
        2. How to log a user out
        3. Limiting access to logged-in users
          1. The raw way
          2. The login_required decorator
          3. Limiting access to logged-in users that pass a test
          4. The permission_required() decorator
          5. Session invalidation on password change
      6. Authentication views
        1. Login
        2. Logout
        3. Logout_then_login
        4. Password_change
        5. Password_change_done
        6. Password_reset
        7. Password_reset_done
        8. Password_reset_confirm
        9. Password_reset_complete
        10. The redirect_to_login helper function
        11. Built-in forms
      7. Authenticating data in templates
        1. Users
        2. Permissions
      8. Managing users in the admin
        1. Creating users
        2. Changing passwords
      9. Password management in Django
        1. How Django stores passwords
        2. Using Bcrypt with Django
          1. Password truncation with BCryptPasswordHasher
          2. Other Bcrypt implementations
          3. Increasing the work factor
        3. Password upgrading
        4. Manually managing a user's password
      10. Customizing authentication in Django
        1. Other authentication sources
        2. Specifying authentication backends
        3. Writing an authentication backend
        4. Handling authorization in custom backends
        5. Authorization for anonymous users
        6. Authorization for inactive users
        7. Handling object permissions
      11. Custom permissions
      12. Extending the existing user model
      13. Substituting a custom user model
      14. What's next?
    17. 12. Testing in Django
      1. Introduction to testing
      2. Introducing automated testing
        1. What are automated tests?
        2. So why create tests?
      3. Basic testing strategies
      4. Writing a test
      5. Creating a test
      6. Running tests
      7. Testing tools
        1. The test client
        2. Provided TestCase classes
          1. Simple TestCase
          2. Transaction TestCase
          3. TestCase
          4. LiveServerTestCase
        3. Test cases features
          1. Default test client
          2. Fixture loading
          3. Overriding settings
            1. settings()
            2. modify_settings()
            3. override_settings()
            4. modify_settings()
          4. Assertions
        4. Email services
        5. Management commands
        6. Skipping tests
      8. The test database
      9. Using different testing frameworks
      10. What's next?
    18. 13. Deploying Django
      1. Preparing your codebase for production
        1. Deployment checklist
      2. Critical settings
        1. SECRET_KEY
        2. DEBUG
      3. Environment-specific settings
        1. ALLOWED_HOSTS
        2. CACHES
        3. DATABASES
        4. EMAIL_BACKEND and Related Settings
        5. STATIC_ROOT and STATIC_URL
        6. MEDIA_ROOT and MEDIA_URL
      4. HTTPS
        1. CSRF_COOKIE_SECURE
        2. SESSION_COOKIE_SECURE
      5. Performance optimizations
        1. CONN_MAX_AGE
        2. TEMPLATES
      6. Error reporting
        1. LOGGING
        2. ADMINS and MANAGERS
        3. Customize the default error views
      7. Using a virtualenv
      8. Using different settings for production
      9. Deploying Django to a production server
      10. Deploying Django with Apache and mod_wsgi
        1. Basic configuration
        2. Using mod_wsgi daemon Mode
        3. Serving files
        4. Serving the admin files
        5. If you get a UnicodEncodError
      11. Serving static files in production
        1. Serving the site and your static files from the same server
        2. Serving static files from a dedicated server
        3. Serving static files from a cloud service or CDN
      12. Scaling
        1. Running on a single server
        2. Separating out the database server
        3. Running a separate media server
        4. Implementing load balancing and redundancy
        5. Going big
      13. Performance tuning
        1. There's no such thing as Too Much RAM
        2. Turn off Keep-Alive
        3. Use Memcached
        4. Use Memcached often
        5. Join the conversation
      14. What's next?
    19. 14. Generating Non-HTML Content
      1. The basics: views and MIME types
      2. Producing CSV
        1. Streaming large CSV files
      3. Using the template system
      4. Other text-based formats
      5. Generating PDF
      6. Install ReportLab
      7. Write your view
      8. Complex PDF's
      9. Further resources
      10. Other possibilities
      11. The syndication feed framework
      12. The high-level framework
        1. Overview
        2. Feed classes
        3. A simple example
        4. A complex example
        5. Specifying the type of feed
        6. Enclosures
        7. Language
        8. URLs
        9. Publishing Atom and RSS Feeds in tandem
      13. The low-level framework
        1. SyndicationFeed classes
          1. SyndicationFeed.__init__()
          2. SyndicationFeed.add_item()
          3. SyndicationFeed.write()
          4. SyndicationFeed.writeString()
        2. Custom feed generators
          1. SyndicationFeed.root_attributes(self, )
          2. SyndicationFeed.add_root_elements(self, handler)
          3. SyndicationFeed.item_attributes(self, item)
          4. SyndicationFeed.add_item_elements(self, handler, item)
      14. The Sitemap framework
        1. Installation
        2. Initialization
        3. Sitemap classes
        4. A simple example
        5. Sitemap class reference
          1. items
          2. location
          3. lastmod
          4. changefreq
          5. priority
          6. protocol
          7. i18n
        6. Shortcuts
          1. Example
        7. Sitemap for static views
        8. Creating a sitemap index
        9. Template customization
        10. Context variables
          1. Index
          2. Sitemap
        11. Pinging google
          1. django.contrib.syndication.ping_google()
          2. Pinging Google via manage.py
      15. What's next?
    20. 15. Django Sessions
      1. Enabling sessions
      2. Configuring the session engine
        1. Using database-backed sessions
        2. Using cached sessions
        3. Using file-based sessions
        4. Using cookie-based sessions
      3. Using Sessions in Views
        1. flush()
        2. set_test_cookie()
        3. test_cookie_worked()
        4. delete_test_cookie()
        5. set_expiry(value)
        6. get_expiry_age()
        7. get_expiry_date()
        8. get_expire_at_browser_close()
        9. clear_expired()
        10. cycle_key()
      4. Session object guidelines
      5. Session serialization
        1. Bundled serializers
          1. serializers.JSONSerializer
          2. serializers.PickleSerializer
        2. Write your own serializer
      6. Setting test cookies
      7. Using sessions out of views
      8. When sessions are saved
      9. Browser-length sessions vs. persistent sessions
      10. Clearing the session store
      11. What's next
    21. 16. Djangos Cache Framework
      1. Setting up the cache
        1. Memcached
        2. Database caching
          1. Creating the cache table
          2. Multiple databases
        3. Filesystem caching
        4. Local-memory caching
        5. Dummy caching (for development)
        6. Using a custom cache backend
        7. Cache arguments
      2. The per-site cache
      3. The per-view cache
        1. Specifying per-view Cache in the URLconf
      4. Template fragment caching
      5. The low-level cache API
        1. Accessing the cache
        2. Basic usage
        3. Cache key prefixing
        4. Cache versioning
        5. Cache key transformation
        6. Cache key warnings
      6. Downstream caches
      7. Using vary headers
      8. Controlling cache: using other headers
      9. What's next?
    22. 17. Django Middleware
      1. Activating middleware
      2. Hooks and application order
      3. Writing your own middleware
        1. process_request
        2. process_view
        3. process_template_response
        4. process_response
          1. Dealing with streaming responses
        5. process_exception
        6. __init__
          1. Marking middleware as unused
        7. Additional guidelines
      4. Available middleware
        1. Cache middleware
        2. Common middleware
        3. GZip middleware
        4. Conditional GET middleware
        5. Locale middleware
        6. Message middleware
        7. Security middleware
          1. HTTP strict transport security
          2. X-content-type-options: nosniff
          3. X-XSS-protection
          4. SSL redirect
        8. Session middleware
        9. Site middleware
        10. Authentication middleware
        11. CSRF protection middleware
        12. X-Frame-options middleware
      5. Middleware ordering
      6. What's next?
    23. 18. Internationalization
      1. Definitions
        1. Internationalization
        2. Localization
          1. locale name
          2. language code
          3. message file
          4. translation string
          5. format file
      2. Translation
      3. Internationalization: in Python code
        1. Standard translation
        2. Comments for Translators
        3. Marking strings as No-Op
        4. Pluralization
        5. Contextual markers
        6. Lazy translation
          1. Model fields and relationships
          2. Model verbose names values
          3. Model methods short_description attribute values
        7. Working with lazy translation objects
          1. Lazy translations and plural
          2. Joining strings: string_concat()
          3. Other uses of lazy in delayed translations
        8. Localized names of languages
      4. Internationalization: In template code
        1. trans template tag
        2. blocktrans template tag
        3. String literals passed to tags and filters
        4. Comments for translators in templates
        5. Switching language in templates
        6. Other tags
      5. Internationalization: In Javascript code
        1. The javascript_catalog view
        2. Using the JavaScript translation catalog
        3. Note on performance
      6. Internationalization: In URL patterns
        1. Language prefix in URL patterns
        2. Translating URL patterns
        3. Reversing in templates
      7. Localization: How to create language files
        1. Message files
        2. Compiling message files
        3. Creating message files from JavaScript source code
        4. gettext on windows
        5. Customizing the makemessages command
      8. Explicitly setting the active language
      9. Using translations outside views and templates
      10. Implementation notes
        1. Specialties of Django translation
        2. How Django discovers language preference
        3. How Django discovers translations
      11. What's next?
    24. 19. Security in Django
      1. Django's built in security features
        1. Cross Site Scripting (XSS) protection
        2. Cross Site Request Forgery (CSRF) protection
          1. How to use it
          2. AJAX
          3. Other template engines
          4. The decorator method
          5. Rejected requests
            1. How it works
          6. Caching
          7. Testing
          8. Limitations
          9. Edge cases
          10. Utilities
            1. django.views.decorators.csrf.csrf_exempt(view)
            2. django.views.decorators.csrf.requires_csrf_token(view)
            3. django.views.decorators.csrf.ensure_csrf_cookie(view)
          11. Contrib and reusable apps
          12. CSRF settings
        3. SOL injection protection
        4. Clickjacking protection
          1. An example of clickjacking
          2. Preventing clickjacking
          3. How to use it
            1. Setting X-Frame-Options for all responses
            2. Setting X-Frame-Options per view
          4. Limitations
          5. Browsers that support X-Frame-Options
        5. SSL/HTTPS
          1. HTTP strict transport security
        6. Host header validation
        7. Session security
          1. User-Uploaded content
      2. Additional security tips
        1. Archive of security issues
        2. Cryptographic signing
          1. Protecting the SECRET_KEY
          2. Using the low-level API
          3. Using the salt argument
          4. Verifying timestamped values
          5. Protecting complex data structures
          6. Security middleware
          7. What's next?
    25. 20. More on Installing Django
      1. Running other databases
      2. Installing Django manually
      3. Upgrading Django
        1. Remove any old versions of Django
      4. Installing a Distribution-specific package
      5. Installing the development version
      6. What's next?
    26. 21. Advanced Database Management
      1. General notes
        1. Persistent connections
          1. Connection management
          2. Caveats
        2. Encoding
      2. postgreSQL notes
        1. Optimizing postgreSQL's configuration
        2. Isolation level
        3. Indexes for varchar and text columns
      3. MySQL notes
        1. Version support
        2. Storage engines
        3. MySQL DB API drivers
          1. mySQLdb
          2. mySQLclient
          3. mySQL connector/python
        4. Timezone definitions
        5. Creating your database
          1. Collation settings
        6. Connecting to the database
        7. Creating your tables
        8. Table names
        9. Savepoints
        10. Notes on specific fields
          1. Character fields
          2. Fractional seconds support for time and datetime fields
          3. TIMESTAMP columns
          4. Row locking with Queryset.Select_For_Update()
          5. Automatic typecasting can cause unexpected results
      4. SQLite notes
        1. Substring matching and case sensitivity
        2. Old SQLite and CASE expressions
        3. Using newer versions of the SQLite DB-API 2.0 driver
        4. Database is locked errors
          1. queryset.Select_For_Update() not Supported
          2. pyformat parameter style in raw queries not supported
          3. Parameters not quoted in connection.queries
      5. Oracle notes
        1. Connecting to the database
        2. Threaded option
        3. INSERT ... RETURNING INTO
        4. Naming issues
        5. NULL and empty strings
        6. Textfield limitations
      6. Using a 3rd-Party database backend
      7. Integrating Django with a legacy database
        1. Give Django your database parameters
        2. Auto-generate the models
        3. Install the core Django tables
        4. Cleaning up generated models
        5. Test and tweak
      8. What's next?
    27. A. Model Definition Reference
      1. Fields
        1. Field name restrictions
        2. FileField notes
          1. FileField FileField.upload_to
          2. FileField.storage
          3. FileField and FieldFile
            1. FieldFile.url
            2. FieldFile.open(mode='rb')
            3. FieldFile.close()
            4. FieldFile.save(name, content, save=True)
            5. FieldFile.delete(save=True)
      2. Universal field options
      3. Field attribute reference
        1. Attributes for fields
          1. Field.auto_created
          2. Field.concrete
          3. Field.hidden
          4. Field.is_relation
          5. Field.model
        2. Attributes for fields with relations
          1. Field.many_to_many
          2. Field.many_to_one
          3. Field.one_to_many
          4. Field.one_to_one
          5. Field.related_model
      4. Relationships
        1. ForeignKey
          1. Database representation
          2. Arguments
            1. limit_choices_to
            2. related_name
            3. related_query_name
            4. to_field
            5. db_constraint
            6. on_delete
            7. swappable
        2. ManyToManyField
          1. Database representation
          2. Arguments
            1. related_name
            2. related_query_name
            3. limit_choices_to
            4. symmetrical
            5. through
            6. through_fields
            7. db_table
            8. db_constraint
            9. swappable
        3. OneToOneField
          1. parent_link
      5. Model metadata options
    28. B. Database API Reference
      1. Creating objects
      2. Saving changes to objects
        1. Saving ForeignKey and ManyToManyField fields
      3. Retrieving objects
        1. Retrieving all objects
        2. Retrieving specific objects with filters
          1. Chaining filters
        3. Filtered querysets are unique
          1. QuerySets are lazy
        4. Retrieving a single object with get
        5. Other queryset methods
        6. Limiting querysets
        7. Field lookups
        8. Lookups that span relationships
          1. Spanning multi-valued relationships
        9. Filters can reference fields on the model
        10. The pk lookup shortcut
        11. Escaping percent signs and underscores in LIKE statements
        12. Caching and querysets
          1. When querysets are not cached
      4. Complex lookups with Q objects
      5. Comparing objects
      6. Deleting objects
      7. Copying model instances
      8. Updating multiple objects at once
      9. Related objects
        1. One-to-many relationships
          1. Forward
          2. Following relationships backward
          3. Using a custom reverse manager
          4. Additional methods to handle related objects
        2. Many-to-many relationships
        3. One-to-one relationships
        4. Queries over related objects
      10. Falling back to raw SQL
    29. C. Generic View Reference
      1. Common arguments to generic views
      2. Simple generic views
        1. Rendering a template-TemplateView
        2. Redirecting to another URL
          1. Attributes
            1. url
            2. pattern_name
            3. permanent
            4. query_string
          2. Methods
      3. List/detail generic views
        1. Lists of objects
        2. Detail views
      4. Date-Based Generic Views
        1. ArchiveIndexView
        2. YearArchiveView
        3. MonthArchiveView
        4. WeekArchiveView
        5. DayArchiveView
        6. TodayArchiveView
        7. DateDetailView
      5. Form handling with class-based views
        1. Basic forms
        2. Model forms
        3. Models and request.user
        4. AJAX example
    30. D. Settings
      1. What's a settings file?
        1. Default settings
        2. Seeing which settings you've changed
      2. Using settings in Python code
      3. Altering settings at runtime
      4. Security
      5. Creating your own settings
      6. DJANGO_SETTINGS_MODULE
        1. The django-admin utility
        2. On the server (mod_wsgi)
      7. Using settings without setting DJANGO_SETTINGS_MODULE
        1. Custom default settings
        2. Either configure() or DJANGO_SETTINGS_MODULE is required
      8. Available settings
        1. Core settings
        2. Auth
        3. Messages
        4. Sessions
        5. Sites
        6. Static files
    31. E. Built-in Template Tags and Filters
      1. Built-in tags
        1. autoescape
        2. block
        3. comment
        4. csrf_token
        5. cycle
        6. debug
        7. extends
        8. filter
        9. firstof
        10. for
        11. for... empty
        12. if
          1. Boolean operators
          2. Complex expressions
          3. Filters
        13. ifchanged
        14. ifequal
        15. ifnotequal
        16. include
        17. load
        18. lorem
        19. now
        20. regroup
        21. spaceless
        22. templatetag
        23. url
        24. verbatim
        25. widthratio
        26. with
      2. Built-in filters
        1. add
        2. addslashes
        3. capfirst
        4. center
        5. cut
        6. date
        7. default
        8. default_if_none
        9. dictsort
        10. dictsortreversed
        11. divisibleby
        12. escape
        13. escapejs
        14. filesizeformat
        15. first
        16. floatformat
        17. get_digit
        18. iriencode
        19. join
        20. last
        21. length
        22. length_is
        23. linebreaks
        24. linebreaksbr
        25. linenumbers
        26. ljust
        27. lower
        28. make_list
        29. phone2numeric
        30. pluralize
        31. pprint
        32. random
        33. rjust
        34. safe
        35. safeseq
        36. slice
        37. slugify
        38. stringformat
        39. striptags
        40. time
        41. timesince
        42. timeuntil
        43. title
        44. truncatechars
        45. truncatechars_html
        46. truncatewords
        47. truncatewords_html
        48. unordered_list
        49. upper
        50. urlencode
        51. urlize
        52. urlizetrunc
        53. wordcount
        54. wordwrap
        55. yesno
      3. Internationalization tags and filters
        1. i18n
        2. l10n
        3. tz
      4. Other tags and filters libraries
        1. static
        2. get_static_prefix
        3. get_media_prefix
    32. F. Request and Response Objects
      1. HttpRequest objects
        1. Attributes
        2. Methods
      2. QueryDict objects
        1. Methods
      3. HttpResponse objects
        1. Usage
        2. Attributes
        3. Methods
        4. HttpResponse subclasses
      4. JsonResponse Objects
        1. Usage
      5. StreamingHttpResponse objects
        1. Performance considerations
        2. Attributes
      6. FileResponse objects
      7. Error views
        1. The 404 (page not found) view
        2. The 500 (server error) view
        3. The 403 (HTTP Forbidden) view
        4. The 400 (bad request) view
      8. Customizing error views
    33. G. Developing Django with Visual Studio
      1. Installing Visual Studio
        1. Install PTVS and Web Essentials
      2. Creating A Django project
        1. Start a Django project
      3. Django development in Visual Studio
        1. Integration of Django management commands
        2. Easy installation of Python packages
        3. Easy installation of new Django apps

Product information

  • Title: Mastering Django: Core
  • Author(s): Nigel George
  • Release date: December 2016
  • Publisher(s): Packt Publishing
  • ISBN: 9781787281141