Appendix C. Database API Reference

Django's database API is the other half of the model API discussed in Appendix B. Once you've defined a model, you'll use this API any time you need to access the database. You've seen examples of this API in use throughout the book; this appendix explains all the various options in detail.

Like the model APIs discussed in Appendix B, though, these APIs are considered very stable, the Django developers consistently add new shortcuts and conveniences. It's a good idea to always check the latest documentation online, available at http://www.djangoproject.com/documentation/0.96/db-api/.

Throughout this reference, we'll refer to the following models, which might form a simple Weblog application:

from django.db import ...

Get The Definitive Guide to Django: Web Development Done Right now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.