... file object that this class wraps. この属性をサブクラスで扱う場合には注意が必要です。 Some subclasses of File , including ContentFile and FieldFile , may replace this attribute with an object other than a Python file object . In these cases, this attribute ... into , readline , readlines , seek , tell , truncate , write , writelines , readable() , writable() , および seekable() 。 ContentFile クラス class ContentFile ( content , name = None ) [ソース] ContentFile クラスは File を継承していますが、 File とは異なり ... 、実際のファイルではなく文字列コンテンツ(バイトもサポート)で操作します。例えば: from django.core.files.base import ContentFile f1 = ContentFile ( "esta frase está en español" ) f2 = ContentFile ( b "these are bytes" ) ImageFile クラス class ImageFil ... ... ... か、(たいていはより便利な)グローバルなデフォルトストレージシステムを使用できます。 >>> from django.core.files.base import ContentFile >>> from django.core.files.storage import default_storage >>> path = default_storage . save ( "path/to/file" , ContentFile ... ... のようなオブジェクトを代入できます: from django.core.management.base import BaseCommand from django.core.files.base import ContentFile class MyCommand ( BaseCommand ): def handle ( self , * args , ** options ): content_file = ContentFile ( b "Hello world!" ... ... ) myfile = File ( f ) もしくは、以下のように Python の文字列から構築することもできます: from django.core.files.base import ContentFile myfile = ContentFile ( "hello world" ) より詳しくは ファイルの管理 を参照してください。 FieldFile. delete ( save = True ) ... ... equest の属性) (LogEntry の属性) (models.Permission の属性) (UploadedFile の属性) content_type_extra (UploadedFile の属性) ContentFile (django.core.files.base のクラス) ContentSecurityPolicyMiddleware (django.middleware.csp のクラス) ContentType (django.con ... 2026年10月08日