... パーサは、パラメータを取得して Node オブジェクトを作成する必要があります: from django import template def do_current_time ( parser , token ): try : # split_contents() knows not to split quoted strings. tag_name , format_string = token . split_contents ( ... taxError ( " %r tag's argument should be in quotes" % tag_name ) return CurrentTimeNode ( format_string [ 1 : - 1 ]) メモ: parser はテンプレートパーサーオブジェクトです。この例では不要です。 token.contents はタグの生の内容を表す文字列です。この例では ' ... ルタ登録と同様に、これをデコレータとして使うこともできます。 @register . tag ( name = "current_time" ) def do_current_time ( parser , token ): ... @register . tag def shout ( parser , token ): ... name 引数を省略した場合、上記の2番目の例と同じように、Dja ... ... t Question as Poll class Command ( BaseCommand ): help = "Closes the specified poll for voting" def add_arguments ( self , parser ): parser . add_argument ( "poll_ids" , nargs = "+" , type = int ) def handle ( self , * args , ** options ): for poll_id ... ムオプションは、次のように add_arguments() メソッドで追加できます: class Command ( BaseCommand ): def add_arguments ( self , parser ): # Positional arguments parser . add_argument ( "poll_ids" , nargs = "+" , type = int ) # Named (optional) arguments par ... ommand ): def __init__ ( self , * args , ** kwargs ): super () . __init__ ( * args , ** kwargs ) # ... BaseCommand. create_parser ( prog_name , subcommand , ** kwargs ) [ソース] CommandParser インスタンスを返します。これは ArgumentParser サブクラスで、 ... ... restrictive value. This host validation is disabled when DEBUG is True or when running tests. XML deserialization The XML parser in the Python standard library is vulnerable to a number of attacks via external entities and entity expansion. Django use ... s this parser for deserializing XML-formatted database fixtures. The fixture deserializer is not intended for use with untrusted data, b ... ... restrictive value. This host validation is disabled when DEBUG is True or when running tests. XML deserialization The XML parser in the Python standard library is vulnerable to a number of attacks via external entities and entity expansion. Django use ... s this parser for deserializing XML-formatted database fixtures. This deserializer is not intended for use with untrusted data, but in o ... ... er to set arbitrary cookies leading to a bypass of CSRF protection. The parser for request.COOKIES is simplified to better match the behavior of browsers and to mitigate this attack. request.COOKIES ma ... ... sing could allow an attacker to set arbitrary cookies leading to a bypass of CSRF protection. The parser for request.COOKIES is simplified to better match the behavior of browsers and to mitigate this attack. request.COOKIES ma ... ... け付けるようにしてください。 テストランナーでは、追加のコマンドラインオプションを定義することもできます。 add_arguments(cls, parser) クラスメソッドを作成またはオーバーライドし、そのメソッド内で parser.add_argument() を呼び出すときにカスタム引数を追加する ... を参照してください)。 このメソッドは、失敗したテストの数を返す必要があります。 classmethod DiscoverRunner. add_arguments ( parser ) [ソース] Override this class method to add custom arguments accepted by the test management command. See argparse.Argume ... ntParser.add_argument() for details about adding arguments to a parser. DiscoverRunner. setup_test_environment ( ** kwargs ) [ソース ... ... and body during redirects, using 307/308 status codes instead of 302/301. 管理コマンド Management commands now set ArgumentParser 's suggest_on_error argument to True by default on Python 3.14, enabling suggestions for incorrectly typed subcommand name ... lid Base64 strings now raise ValidationError instead of being silently accepted. Request と Response HttpRequest.multipart_parser_class can now be customized to use a different multipart parser class. HttpResponseRedirect (and its subclasses), as well ... ラーレポートの管理 ), you may want to review the updates in the base BrokenLinkEmailsMiddleware class. django.http.multipartparser.MultiPartParser now uses strict Base64 validation when decoding encoded request data. Previously, invalid data could be si ... ... unner to add more arguments (à la optparse ). Now to implement the same behavior, you have to create an add_arguments(cls, parser) class method on the test runner and call parser.add_argument to add any custom arguments, as parser is now an argparse.Ar ... gumentParser instance. Model check ensures auto-generated column names are within limits specified by database A field name that's long ... ... tion_compatible 属性を使用すると、制約の検証時にその式を無視するよう指定することができます。 テンプレート カスタムタグは、 Parser オブジェクトに追加のデータを設定できるようになりました。このデータは Template インスタンス上で利用可能になります。このよう ... うになります。 django.utils.text.Truncator used by truncatechars_html and truncatewords_html template filters now uses html.parser.HTMLParser subclasses. This results in a more robust and faster operation, but there may be small differences in the outpu ... 2026年10月08日