... ドが使用できます。 データのシリアライズ 最も高いレベルでは、次のようにデータをシリアライズできます。 from django.core import serializers data = serializers . serialize ( "json" , SomeModel . objects . all ()) serialize 関数の引数は、データをシリアライズするフ ... Django モデルのインスタンスを yield するどんなイテレータでも渡せますが、ほとんど場合は QuerySet になります。) django.core.serializers. get_serializer ( format ) シリアライザーオブジェクトを次のように直接使用することもできます。 JSONSerializer = serializers ... lize ( SomeModel . objects . all (), stream = out ) 注釈 get_serializer() を未知の フォーマット で呼び出すと、 django.core.serializers.SerializerDoesNotExist 例外が発生します。 フィールドのサブセット フィールドのサブセットのみをシリアライズしたい場合は、次の ... ... は、代わりにプレーンな json シリアライザ を使用してください。 json シリアライザのオプションに加えて、 geojson シリアライザは serializers.serialize() によって呼び出されたときに、以下の追加オプションを受け付けます: geometry_field : GeoJSON フィーチャの geometry ... てのシリアライザと同様に機能し、 properties キーに存在するフィールドを制限するために使用できます。 実装例: from django.core.serializers import serialize from my_app.models import City serialize ( "geojson" , City . objects . all (), geometry_field = "point" ... ... e complexity when deserializing crafted documents containing many nested invalid elements. The internal helper django.core.serializers.xml_serializer.getInnerText() previously accumulated inner text inefficiently during recursion. It now collects text per e ... ... e complexity when deserializing crafted documents containing many nested invalid elements. The internal helper django.core.serializers.xml_serializer.getInnerText() previously accumulated inner text inefficiently during recursion. It now collects text per e ... ... e complexity when deserializing crafted documents containing many nested invalid elements. The internal helper django.core.serializers.xml_serializer.getInnerText() previously accumulated inner text inefficiently during recursion. It now collects text per e ... ... of migration operations that will be performed. NoneType can now be serialized in migrations. You can now register custom serializers for migrations. モデル Added support for PostgreSQL operator classes ( Index.opclasses ). Added support for partial indexe ... You can now deserialize data using natural keys containing forward references by passing handle_forward_references=True to serializers.deserialize() . Additionally, loaddata handles forward references automatically. テスト The new SimpleTestCase.assertURLEq ... ... ettings.configure() django.core.cache.utils.make_template_fragment_key() django.core.management.call_command() django.core.serializers.get_serializer() django.views.decorators.cache.cache_page() bulk_create() (django.db.models.query.QuerySet モジュール) bul ... odule django.contrib.gis.geoip2 module django.contrib.gis.geos module django.contrib.gis.measure module django.contrib.gis.serializers.geojson module django.contrib.gis.utils module django.contrib.gis.utils.layermapping module django.contrib.gis.utils.ogrin ... go.core.management module django.core.management.call_command() built-in function django.core.paginator module django.core.serializers.get_serializer() built-in function django.core.serializers.json.DjangoJSONEncoder (組み込みクラス) django.core.signals mod ... ... face to the GEOS library. django.contrib.gis.measure GeoDjango's distance and area measurement objects. django.contrib.gis.serializers.geojson Serialization of GeoDjango models in the GeoJSON format. django.contrib.gis.utils GeoDjango's collection of utilit ... ... ブジェクトを JSON としてダンプするエクスポート関数を書くには、Django の シリアライズ関数 を使います: from django.core import serializers from django.http import HttpResponse def export_as_json ( modeladmin , request , queryset ): response = HttpResponse ( con ... tent_type = "application/json" ) serializers . serialize ( "json" , queryset , stream = response ) return response 通常、上記のようなことはあまり良いアイデアとはみなさ ... ... rity header. ConditionalGetMiddleware now adds the ETag header to responses. シリアライズ (シリアル化) The new django.core.serializers.base.Serializer.stream_class attribute allows subclasses to customize the default stream. The encoder used by the JSON ser ... ializer can now be customized by passing a cls keyword argument to the serializers.serialize() function. DjangoJSONEncoder now serializes timedelta objects (used by DurationField ). テンプレート mark_safe( ... 2026年10月08日