From e527c0b6d808cb8e4bedf79ded3dc4ad1a7e17a8 Mon Sep 17 00:00:00 2001 From: Tai Lee Date: Wed, 1 Aug 2012 11:49:01 +1000 Subject: Fixed #13252 -- Added ability to serialize with natural primary keys. Added ``--natural-foreign`` and ``--natural-primary`` options and deprecated the ``--natural`` option to the ``dumpdata`` management command. Added ``use_natural_foreign_keys`` and ``use_natural_primary_keys`` arguments and deprecated the ``use_natural_keys`` argument to ``django.core.serializers.Serializer.serialize()``. Thanks SmileyChris for the suggestion. --- docs/ref/django-admin.txt | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'docs/ref') diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 5bc9a2b83e..39cbbc8dd5 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -220,13 +220,34 @@ also mix application names and model names. The :djadminopt:`--database` option can be used to specify the database from which data will be dumped. +.. django-admin-option:: --natural-foreign + +.. versionadded:: 1.7 + +When this option is specified, Django will use the ``natural_key()`` model +method to serialize any foreign key and many-to-many relationship to objects of +the type that defines the method. If you are dumping ``contrib.auth`` +``Permission`` objects or ``contrib.contenttypes`` ``ContentType`` objects, you +should probably be using this flag. See the :ref:`natural keys +` documentation for more details on this +and the next option. + +.. django-admin-option:: --natural-primary + +.. versionadded:: 1.7 + +When this option is specified, Django will not provide the primary key in the +serialized data of this object since it can be calculated during +deserialization. + .. django-admin-option:: --natural +.. deprecated:: 1.7 + Equivalent to the :djadminopt:`--natural-foreign` option; use that instead. + Use :ref:`natural keys ` to represent any foreign key and many-to-many relationship with a model that provides -a natural key definition. If you are dumping ``contrib.auth`` ``Permission`` -objects or ``contrib.contenttypes`` ``ContentType`` objects, you should -probably be using this flag. +a natural key definition. .. versionadded:: 1.6 -- cgit v1.3