... ます。 フィクスチャを使う フィクスチャを使えば、 テスト のためのデータを事前に投入できます。 class MyTestCase ( TestCase ): fixtures = [ "fixture-label" ] または 初期データ を loaddata コマンドを使って提供することもできます: django-admin loaddata <fixtur ... el> Djangoにフィクスチャを認識させる Django はこれらの場所でフィクスチャを探します: インストールされた各アプリケーションの fixtures ディレクトリ内 FIXTURE_DIRS 設定にリストされている任意のディレクトリ内 フィクスチャによって名前が付けられたリテラル パス内 ... す。たとえば: django-admin loaddata foo/bar/mydata.json これは、インストールされている各アプリケーションに対して <app_label>/fixtures/foo/bar/mydata.json を、 FIXTURE_DIRS 内の各ディレクトリに対して <dirname>/foo/bar/mydata.json を、そしてリテラルパス foo ... ... anslations where the Unicode sequence for the non-breaking space was returned verbatim (#21415). Fixed loaddata error when fixture file name contained any dots not related to file extensions (#21457) or when fixture path was relative but located in a su ... ... いくつかの制限 はありますが、そのデータはテストデータベースでも利用できます。 フィクスチャでデータを投入する フィクスチャ (fixture) を使ってデータを投入することもできますが、 TransactionTestCase.fixtures を使わない限り、このデータは自動的にはロードされま ... : Lennon - model : myapp.person pk : 2 fields : first_name : Paul last_name : McCartney このデータは、アプリケーション内の fixtures ディレクトリ内に保存しておくことができます。 データを読み込むには、 manage.py loaddata <fixturename> を呼び出します。ここ ... で <fixturename> は作成したフィクスチャファイルの名前です。 loaddata を実行するたびに、フィクスチャからデータが読み込まれ、データベース ... ... トランザクション 複数のデータベース テーブル空間(tablespace) データベースアクセスの最適化 データベースの計測 フィクスチャ (fixture) モデルリレーションシップ API の使用例 ... ... す。 --include-views このオプションを指定すると、データベースビュー用のモデルも作成されます。 loaddata django-admin loaddata fixture [fixture ...] 指定された フィクスチャ の内容を検索してデータベースにロードします。 --database DATABASE データを読み込むデー ... e=prod - dumpdata コマンドは loaddata の入力を生成するために使用できます。 参考 フィクスチャの詳細については フィクスチャ (fixture) トピックを参照してください。 makemessages django-admin makemessages 現在のディレクトリのソースツリー全体を走査し、翻訳が必 ... 力します。 --durations N 最も遅い N 個のテストケースを表示します(N=0 の場合はすべて)。 testserver django-admin testserver [fixture [fixture ...]] ( runserver のように) 与えられたフィクスチャのデータを使って Django 開発サーバを起動します。 たとえばこのコ ... ... er of attacks via external entities and entity expansion. Django uses this parser for deserializing XML-formatted database fixtures. The fixture deserializer is not intended for use with untrusted data, but in order to err on the side of safety in Djang ... ... arsing of the testserver command's positional arguments (fixture names) ( #24571 ). Prevented TypeError in translation functions check_for_language() and get_language_bidi() when translat ... ... ability to set up test data at the class level. Using this technique can speed up the tests as compared to using setUp() . Fixture loading within TestCase is now performed once for the whole TestCase . マイナーな機能 django.contrib.admin ModelAdmin now ... --name allows giving the migration(s) a custom name instead of a generated one. The loaddata command now prevents repeated fixture loading. If FIXTURE_DIRS contains duplicates or a default fixture directory path ( app_name/fixtures ), an exception is ra ... ... example test module: QUnit . module ( 'magicTricks' , { beforeEach : function () { const $ = django . jQuery ; $ ( '#qunit-fixture' ). append ( '<button class="button"></button>' ); } }); QUnit . test ( 'removeOnClick removes button on click' , function ... ... et_new_session_key() has been renamed to _get_new_session_key() . get_new_session_object() no longer exists. フィクスチャ (fixture) Loading a row no longer calls save() Previously, loading a row automatically ran the model's save() method. This is no lo ... ger the case, so any fields (for example: timestamps) that were auto-populated by a save() now need explicit values in any fixture. 設定 Better exceptions The old EnvironmentError has split into an ImportError when Django fails to find the settings modu ... 2026年10月08日