diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-01-08 00:17:33 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-01-08 00:17:33 +0000 |
| commit | 96848352f97e8c2deb976ce4c8418c0d0aa6be5e (patch) | |
| tree | af317184ff4f7681ff0daeb5665e59286949579b /docs/ref/models | |
| parent | 47147071fede992ecb85879a9df2d42876ffc8f9 (diff) | |
Added `using` to the list of documented arguments for save() on a model; updated the docs to suggest using ``*args, **kwargs`` when implementing model save methods. Thanks to Jeff Croft for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12118 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref/models')
| -rw-r--r-- | docs/ref/models/instances.txt | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index 5999038979..f2eb54c217 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -66,15 +66,20 @@ Saving objects To save an object back to the database, call ``save()``: -.. method:: Model.save([force_insert=False, force_update=False]) - -Of course, there are some subtleties; see the sections below. +.. method:: Model.save([force_insert=False, force_update=False, using=DEFAULT_DB_ALIAS]) .. versionadded:: 1.0 + The ``force_insert`` and ``force_update`` arguments were added. + +.. versionadded:: 1.1 + The ``using`` argument was added. + +If you want customized saving behavior, you can override this +``save()`` method. See :ref:`overriding-model-methods` for more +details. -The signature of the ``save()`` method has changed from earlier versions -(``force_insert`` and ``force_update`` have been added). If you are overriding -these methods, be sure to use the correct signature. +The model save process also has some subtleties; see the sections +below. Auto-incrementing primary keys ------------------------------ @@ -265,14 +270,21 @@ For more details, see the documentation on :ref:`F() expressions Deleting objects ================ -.. method:: Model.delete() +.. method:: Model.delete([using=DEFAULT_DB_ALIAS]) + +.. versionadded:: 1.1 + The ``using`` argument was added. + +Issues a SQL ``DELETE`` for the object. This only deletes the object +in the database; the Python instance will still be around, and will +still have data in its fields. - Issues a SQL ``DELETE`` for the object. This only deletes the object in the - database; the Python instance will still be around, and will still have data - in its fields. +For more details, including how to delete objects in bulk, see +:ref:`topics-db-queries-delete`. - For more details, including how to delete objects in bulk, see - :ref:`topics-db-queries-delete`. +If you want customized deletion behavior, you can override this +``delete()`` method. See :ref:`overriding-model-methods` for more +details. .. _model-instance-methods: |
