summaryrefslogtreecommitdiff
path: root/docs/db-api.txt
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2005-07-15 00:42:28 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2005-07-15 00:42:28 +0000
commitf19dbab514d1f53f31fabaaed55cf0e7ca525382 (patch)
treec856e6b3f9864bfc74f6c7cb737b0d7b19d57b1c /docs/db-api.txt
parent5fc13947fcd6c3f3569ce8b643030a645b108037 (diff)
Made a bunch of doc improvements
git-svn-id: http://code.djangoproject.com/svn/django/trunk@41 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/db-api.txt')
-rw-r--r--docs/db-api.txt18
1 files changed, 17 insertions, 1 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt
index 193cbf2b22..2a41e9b373 100644
--- a/docs/db-api.txt
+++ b/docs/db-api.txt
@@ -2,7 +2,11 @@
Database API reference
======================
-XXX INTRO HERE XXX
+Once you've created your `data models`_, you'll need to lookup data from the
+database. This document explains the database abstraction API derived from the
+models, and how to create, retrieve, and update objects.
+
+.. _`data models`: http://www.djangoproject.com/documentation/model_api/
Throughout this reference, we'll refer to the following Poll application::
@@ -287,6 +291,18 @@ For example::
SELECT * FROM polls_polls WHERE question LIKE 'Who%' AND id IN (3, 4, 5, 20);
+Changing objects
+================
+
+Once you've retrieved an object from the database using any of the above
+options, changing it is extremely easy. Make changes directly to the
+objects fields, then call the object's ``save()`` method::
+
+ >>> p = polls.get_object(id__exact=15)
+ >>> p.slug = "new_slug"
+ >>> p.pub_date = datetime.datetime.now()
+ >>> p.save()
+
Creating new objects
====================