... erable to a reflected file download (RFD) attack that sets the Content-Disposition header of a FileResponse when the filename was derived from user-supplied input. The filename is now escaped to avoid this possibility. ... ... ble to a reflected file download (RFD) attack that sets the Content-Disposition header of a FileResponse when the filename was derived from user-supplied input. The filename is now escaped to avoid this possibility. ... ... m/<<RELEASE MANAGER GITHUB USERNAME>>.gpg | gpg --import - Once the key is imported, verify this file: gpg --verify <<THIS FILENAME>> Once you have verified this file, you can use normal MD5, SHA1, or SHA256 checksumming applications to generate the chec ... tarball/ https://www.djangoproject.com/download/<<VERSION>>/wheel/ MD5 checksums ============= <<MD5SUM>> <<RELEASE TAR.GZ FILENAME>> <<MD5SUM>> <<RELEASE WHL FILENAME>> SHA1 checksums ============== <<SHA1SUM>> <<RELEASE TAR.GZ FILENAME>> <<SHA1SUM>> << ... RELEASE WHL FILENAME>> SHA256 checksums ================ <<SHA256SUM>> <<RELEASE TAR.GZ FILENAME>> <<SHA256SUM>> <<RELEASE WHL FILENAME>> Sign ... ... e ( name ) [ソース] name パラメータに基づいて、ターゲットのストレージシステムで使用に適したファイル名を返します。 generate_filename ( filename ) [ソース] Validates the filename by calling get_valid_name and returns a filename to be passed to the save() m ... ethod. The filename argument may include a path as returned by FileField.upload_to . In that case, the path won't be passed to get_valid_name ... ... opriate CSV header. response = HttpResponse ( content_type = "text/csv" , headers = { "Content-Disposition" : 'attachment; filename="somefilename.csv"' }, ) writer = csv . writer ( response ) writer . writerow ([ "First row" , "Foo" , "Bar" , "Baz" ]) wr ... reamingHttpResponse ( stream_batched_rows (), content_type = "text/csv" , headers = { "Content-Disposition" : 'attachment; filename="somefilename.csv"' }, ) テンプレートシステムを使う もしくは、 Django のテンプレートシステム を使って CSV を生成することも ... opriate CSV header. response = HttpResponse ( content_type = "text/csv" , headers = { "Content-Disposition" : 'attachment; filename="somefilename.csv"' }, ) # The data is hardcoded here, but you could load it from a database or # some other source. csv_d ... ... of attachments to put on the message. Each can be an instance of MIMEPart or EmailAttachment , or a tuple with attributes (filename, content, mimetype) . Changed in Django 6.0: Support for MIMEPart objects in the attachments list was added. バージョン 6. ... t. If you add another way to specify recipients in your class, they need to be returned from this method as well. attach ( filename , content , mimetype ) [ソース] attach ( mimepart ) Creates a new attachment and adds it to the message. There are two way ... s to call attach() : You can pass it three arguments: filename , content and mimetype . filename is the name of the file attachment as it will appear in the email, content is the data t ... ... a timezone-aware datetime if USE_TZ is True and a naive datetime in the local timezone otherwise. The new Storage.generate_filename() method makes it easier to implement custom storages that don't use the os.path calls previously in FileField . フォーム ... or will need to implement it in the custom storage's save() method. Private FileField methods get_directory_name() and get_filename() are no longer called (and are now deprecated) which is a backwards incompatible change for users overriding those method ... s on custom fields. To adapt such code, override FileField.generate_filename() or Storage.generate_filename() instead. It might be possible to use upload_to also. The subject of mail sent by AdminEma ... ... 存する file という名前のハンドラを設定します: LOGGING = { # ... "handlers" : { "file" : { "class" : "logging.FileHandler" , "filename" : "general.log" , }, }, } Different handler classes take different configuration options. For more information on availab ... ラはすべてのレベルのログメッセージを受け取ります)。上の例を使うと、次のように書けます: { "class" : "logging.FileHandler" , "filename" : "general.log" , "level" : "DEBUG" , } これで、レベル DEBUG 以上のレコードだけを受け付けるようにハンドラを設定できます。 ... 適用するには、ハンドラの辞書に formatter エントリを追加します: "handlers" : { "file" : { "class" : "logging.FileHandler" , "filename" : "general.log" , "formatter" : "verbose" , }, } ロガーの名前空間を使う 無名のロギング設定 "" は任意の Python アプリケーシ ... ... ut. This principle is explained in our security documentation . For example, the following is not considered valid because filename has not been sanitized: from django.core.files.storage import default_storage from django.http import HttpResponse def my_ ... proof_of_concept ( request ): filename = request . GET . get ( "filename" ) return HttpResponse ( default_storage . open ( f "user/ { filename } " )) Similarly, ... ... browsers # present the option to save the file. buffer . seek ( 0 ) return FileResponse ( buffer , as_attachment = True , filename = "hello.pdf" ) コードとコメントが自分自身の意味を説明しているはずですが、いくつかの点には言及しておくべきでしょう。 レスポ ... chment パラメータが省略された場合、ブラウザはPDFを扱うために設定されたプログラムやプラグインを使ってPDFを扱います。 任意の filename パラメータを指定できます。これはブラウザの "名前を付けて保存" ダイアログで使用されます。 ReportLab API にフックできます: c ... 2026年10月08日