... スト のためのデータを事前に投入できます。 class MyTestCase ( TestCase ): fixtures = [ "fixture-label" ] または 初期データ を loaddata コマンドを使って提供することもできます: django-admin loaddata <fixture label> Djangoにフィクスチャを認識させる Django はこ ... 読み込みます。指定されたフィクスチャに拡張子がある場合、そのタイプのフィクスチャだけが読み込まれます。たとえば django-admin loaddata mydata.json mydata と呼ばれる JSON フィクスチャのみを読み込みます。フィクスチャの拡張子は シリアライザ に登録された名前 (例 ... 子を省略した場合、Django は利用可能なすべてのフィクスチャタイプから、マッチするフィクスチャを検索します。例えば django-admin loaddata mydata これは mydata というフィクスチャタイプのフィクスチャを探します。フィクスチャディレクトリに mydata.json が含まれてい ... ... このデータは、アプリケーション内の fixtures ディレクトリ内に保存しておくことができます。 データを読み込むには、 manage.py loaddata <fixturename> を呼び出します。ここで <fixturename> は作成したフィクスチャファイルの名前です。 loaddata を実行するたびに、フ ... クスチャからデータが読み込まれ、データベースに再ロードされます。これは、フィクスチャによって作成された行の一つを変更してから loaddata を再度実行すると、変更が元に戻ってしまうことを意味します。 フィクスチャファイルを探す場所を Django に教える デフォルトでは ... 、Djangoは各アプリ内の fixtures ディレクトリでフィクスチャを探すため、 loaddata sample コマンドで my_app/fixtures/sample.json ファイルを見つけられます。相対パスも使用できるため、 loaddata my_app/sample ... ... zer does not create documents with a DTD, so this should not cause any issues with the typical round-trip from dumpdata to loaddata , but if you feed your own XML documents to the loaddata management command, you will need to ensure they do not contain a ... ... zer does not create documents with a DTD, so this should not cause any issues with the typical round-trip from dumpdata to loaddata , but if you feed your own XML documents to the loaddata management command, you will need to ensure they do not contain a ... ... プリケーション名が指定されなかった場合、インストールされたすべてのアプリケーションをダンプします。 dumpdata のアウトプットは loaddata に対するインプットして使用できます。 dumpdata の出力をファイルとして保存すると、 テスト の フィクスチャ や、 初期データ と ... のサポートのみが実装されています。 --include-views このオプションを指定すると、データベースビュー用のモデルも作成されます。 loaddata django-admin loaddata fixture [fixture ...] 指定された フィクスチャ の内容を検索してデータベースにロードします。 --databas ... み込む sys.stdin から入力を読み込むには、フィクスチャ名としてハイフンを使用します。たとえば下記のようにします: django-admin loaddata --format=json - stdin から読み込む場合、 --format オプションで入力の シリアライズフォーマット (例 json や xml ) を指定する ... ... --all diffsettings コマンドラインオプション dumpdata コマンドラインオプション makemessages コマンドラインオプション --app loaddata コマンドラインオプション --backwards sqlmigrate コマンドラインオプション --blank ogrinspect コマンドラインオプション --buf ... コマンドラインオプション dumpdata コマンドラインオプション flush コマンドラインオプション inspectdb コマンドラインオプション loaddata コマンドラインオプション migrate コマンドラインオプション remove_stale_contenttypes コマンドラインオプション showmigration ... kemigrations コマンドラインオプション --exclude compilemessages コマンドラインオプション dumpdata コマンドラインオプション loaddata コマンドラインオプション makemessages コマンドラインオプション startapp コマンドラインオプション startproject コマンドライ ... ... manage.py A few of the options to manage.py have changed with the addition of fixture support: There are new dumpdata and loaddata commands which, as you might expect, will dump and load data to/from the database. These commands can operate against any ... of Django's supported serialization formats. The sqlinitialdata command has been renamed to sqlcustom to emphasize that loaddata should be used for data (and sqlcustom for other custom SQL -- views, stored procedures, etc.). The vestigial install comm ... ... .contrib.humanize translations 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 ... ... regression in the admin which ignored line breaks in read-only fields instead of converting them to <br> ( #25465 ). Made loaddata skip disabling and enabling database constraints when it doesn't load any fixtures ( #23372 ). Fixed a crash in QuerySet.v ... ... them to <br> ( #25465 ). Fixed incorrect object reference in SingleObjectMixin.get_context_object_name() ( #26006 ). Made loaddata skip disabling and enabling database constraints when it doesn't load any fixtures ( #23372 ). Restored contrib.auth hashe ... 2026年10月08日