3.5 Templates ................................................. 275
3.6 Class-based views ............................................ 287
3.7 Migrations ................................................ 313
3.8 Managing files .............................................. 324
3.9 Testing in Django ............................................ 327
3.10 User authentication in Django ...................................... 368
3.11 Django’s cache framework ........................................ 418
3.12 Conditional View Processing ....................................... 436
3.13 Cryptographic signing .......................................... 439
3.14 Sending email .............................................. 442
3.15 Internationalization and localization ................................... 452
3.16 Logging .................................................. 497
3.17 Pagination ................................................ 507
3.18 Security in Django ............................................ 511
3.19 Performance and optimization ...................................... 515
3.20 Serializing Django objects ........................................ 521
3.21 Django settings .............................................. 530
3.22 Signals .................................................. 534
3.23 System check framework ......................................... 538
3.24 External packages ............................................ 541
4 “How-to” guides 543
4.1 Authentication using REMOTE_USER .................................. 543
4.2 Writing custom django-admin commands .............................. 545
4.3 Writing custom model fields ....................................... 550
4.4 Custom Lookups ............................................. 560
4.5 Custom template tags and filters ..................................... 565
4.6 Writing a custom storage system ..................................... 582
4.7 Deploying Django ............................................ 583
4.8 Upgrading Django to a newer version .................................. 601
4.9 Providing initial data for models ..................................... 602
4.10 Django on Jython ............................................. 604
4.11 Integrating Django with a legacy database ................................ 604
4.12 Outputting CSV with Django ...................................... 605
4.13 Outputting PDFs with Django ...................................... 607
4.14 Overriding templates ........................................... 609
4.15 Managing static files (e.g. images, JavaScript, CSS) .......................... 610
4.16 How to install Django on Windows ................................... 613
4.17 Writing database migrations ....................................... 614
5 Django FAQ 621
5.1 FAQ: General ............................................... 621
5.2 FAQ: Installation ............................................. 624
5.3 FAQ: Using Django ........................................... 625
5.4 FAQ: Getting Help ............................................ 626
5.5 FAQ: Databases and models ....................................... 627
5.6 FAQ: The admin ............................................. 628
5.7 FAQ: Contributing code ......................................... 630
5.8 Troubleshooting ............................................. 631
6 API Reference 633
6.1 Applications ............................................... 633
6.2 System check framework ......................................... 639
6.3 Built-in class-based views API ...................................... 651
ii