... り自然な (ナチュラルな) 参照が助けになることがあります。 このような理由のために Django が提供しているのが、 ナチュラルキー (natural key) です。ナチュラルキーは、オブジェクトのインスタンスをプライマリーキーの値を使用せずに一意に識別するために使える値のタプ ... はもっとずっと人間によってわかりやすくなります。ナチュラルキーの処理を追加するには、Person のデフォルトの Manager を get_by_natural_key() を使用して定義します。Person の場合、よいナチュラルキーは、first name と last name のペアになるでしょう。 from djang ... o.db import models class PersonManager ( models . Manager ): def get_by_natural_key ( self , first_name , last_name ): return self . get ( first_name = first_name , last_name = last_name ) class Person ... ... nsequence of decisions made in the early days of Django, prior to its open-source release. It's now possible to write more natural, Pythonic code that works as expected, and there's less "black magic" happening behind the scenes. Aside from that, anothe ... evelopers' quality of life. The new features and changes introduced in 0.95 include: Django now uses a more consistent and natural filtering interface for retrieving objects from the database. User-defined models, functions and constants now appear in t ... e framework required that a database be configured, regardless of whether you actually used it. It's now more explicit and natural to override save() and delete() methods on models, rather than needing to hook into the pre_save() and post_save() method ... ... マンド The new --no-color option for django-admin disables the colorization of management command output. The new dumpdata --natural-foreign and dumpdata --natural-primary options, and the new use_natural_foreign_keys and use_natural_primary_keys argument ... s for serializers.serialize() , allow the use of natural primary keys when serializing. It is no longer necessary to provide the cache table name or the --database option for the ... method has been renamed to get_backend_timeout() . Despite being a private API, it will go through the normal deprecation. Natural key serialization options The --natural and -n options for dumpdata have been deprecated. Use dumpdata --natural-foreign i ... ... =auth --exclude=contenttypes --database DATABASE データをダンプするデータベースを指定します。デフォルトは default です。 --natural-foreign natural_key() モデルメソッドを使用して、任意の外部キーと多対多リレーションを、メソッドを定義している種類のオブジェ ... ラグを使う必要があります。このオプションと次のオプションの詳細については、 ナチュラルキー のドキュメントを参照しください。 --natural-primary このオブジェクトのシリアライズされたデータの主キーを省略します。これが省略できるのは、デシリアライズ時に計算できる ... 、以下の構文のいずれかを使って渡すことができます: # Similar to the command line management . call_command ( "dumpdata" , "--natural-foreign" ) # Named argument similar to the command line minus the initial dashes and # with internal dashes replaced by un ... ... _FALLBACK to True to continue accepting legacy signed cookies. シリアライズ (シリアル化) Subclasses of models defining the natural_key() method can now opt out of natural key serialization by overriding the method to return an empty tuple: () . This ens ... ures primary keys are serialized when using dumpdata --natural-primary . The XML deserializer now raises SuspiciousOperation when it encounters unexpected nested tags. Tasks The task() ... ... startapp コマンドラインオプション startproject コマンドラインオプション --name-field ogrinspect コマンドラインオプション --natural-foreign dumpdata コマンドラインオプション --natural-primary dumpdata コマンドラインオプション --no-color コマンドラインオプ ... Set モジュール) aget_all_permissions() (BaseBackend のメソッド) (ModelBackend のメソッド) (models.User のメソッド) aget_by_natural_key() (models.BaseUserManager のメソッド) aget_expire_at_browser_close() (backends.base.SessionBase のメソッド) aget_expir ... y のクラス) dumpdata django-admin command dumpdata コマンドラインオプション --all --database --exclude --format --indent --natural-foreign --natural-primary --output --pks -a -e -o dumps() (django.core.signing モジュール) DurationField (django.db.models ... ... hrough the form, such as with: a OneToOneField (or parent link used as the primary key of an inline formset's model), or a natural or UUID primary key included in the form's fields. Models using the default BigAutoField primary key were not affected. Th ... ... hrough the form, such as with: a OneToOneField (or parent link used as the primary key of an inline formset's model), or a natural or UUID primary key included in the form's fields. Models using the default BigAutoField primary key were not affected. Th ... ... hrough the form, such as with: a OneToOneField (or parent link used as the primary key of an inline formset's model), or a natural or UUID primary key included in the form's fields. Models using the default BigAutoField primary key were not affected. Th ... ... ンスにマッピングした辞書を返します。 for_concrete_models=False により、プロキシモデルの ContentType を取得できます。 get_by_natural_key ( app_label , model ) [ソース] 与えられたアプリケーションラベルとモデル名で一意に識別される ContentType インスタンスを ... ntType オブジェクトを一意に識別するためにナチュラルキーを使用する必要があるでしょう。詳しくは ナチュラルキー と dumpdata --natural-foreign を参照してください。 これにより、通常の ForeignKey と同じような API が利用できるようになります。各 TaggedItem は、 ... 2026年10月08日