... はこのAPIに従う例です。あるクラスが以下のメソッドを実装している場合、そのクラスはクエリ式APIに従っていると言えます: as_sql ( compiler , connection ) 式の SQL フラグメントを生成します。タプル (sql, params) を返します。 sql は SQL 文字列で、 params はクエリ ... パラメータのリストまたはタプルです。 compiler は SQLCompiler オブジェクトで、他の式をコンパイルするための compile() メソッドを持っています。 connection はクエリの実行に ... 使用する接続です。 expression.as_sql() の呼び出しは通常正しくありません。 代わりに compiler.compile(expression) を使用する必要があります。 compiler.compile() メソッドは式のベンダ固有のメソッドの呼び出しを行います。 ... ... ます。これはコンパイルされた正規表現オブジェクトのリストでなければなりません。例えば: import re IGNORABLE_404_URLS = [ re . compile ( r "\.(php|cgi)$" ), re . compile ( r "^/phpmyadmin/" ), ] この例では、 .php または .cgi で終わる URL への 404 は報告され ... ん。 以下は、ブラウザやクローラがよくリクエストする従来の URL を除外する方法の例です: import re IGNORABLE_404_URLS = [ re . compile ( r "^/apple-touch-icon.*\.png$" ), re . compile ( r "^/favicon\.ico$" ), re . compile ( r "^/robots\.txt$" ), ] (これらは ... hidden_settings センシティブな設定や request.META にマッチする正規表現オブジェクト。デフォルトでは下記です: import re re . compile ( r "API|AUTH|TOKEN|KEY|SECRET|PASS|SIGNATURE|HTTP_COOKIE" , flags = re . IGNORECASE ) is_active ( request ) [ソース] get_ ... ... those files now have some invalid Python syntax. This causes difficulties for packaging systems that unconditionally byte-compile *.py files. To remedy this, a .py-tpl suffix is now used for the project and app template files included in Django. The .p ... on SQLite with more than 2000 parameters when DEBUG is True on distributions that increase the SQLITE_MAX_VARIABLE_NUMBER compile-time limit to over 2000, such as Debian ( #26063 ). Fixed a crash when using a reverse OneToOneField in ModelAdmin.readonl ... ... させる必要があります。 from django.db.models import Lookup class NotEqual ( Lookup ): lookup_name = "ne" def as_sql ( self , compiler , connection ): lhs , lhs_params = self . process_lhs ( compiler , connection ) rhs , rhs_params = self . process_rhs ( c ... ならない制約は、文字列 __ を決して含んではならないということです。 We then need to define the as_sql method. This takes a SQLCompiler object, called compiler , and the active database connection. SQLCompiler objects are not documented, but the only thing ... we need to know about them is that they have a compile() method which returns a tuple containing an SQL string, and the parameters to be interpolated into that string. In most c ... ... ffixes to IGNORABLE_404_ENDS . In Django 1.4, these two settings are superseded by IGNORABLE_404_URLS , which is a list of compiled regular expressions. Django won't send an email for 404 errors on URLs that match any of them. Furthermore, the previous ... e following lines in your settings file: import re IGNORABLE_404_URLS = ( # for each <prefix> in IGNORABLE_404_STARTS re . compile ( r "^<prefix>" ), # for each <suffix> in IGNORABLE_404_ENDS re . compile ( r "<suffix>$" ), ) Don't forget to escape char ... guments, which could lead to it erroneously considering an argument as a string literal when it wasn't. It now uses parser.compile_filter , like other tags. The internals of the tag aren't part of the official stable API, but in the interests of full di ... ... ort gettext_lazy as _ def parse_hand ( hand_string ): """Takes a string of cards and splits into a full hand.""" p1 = re . compile ( ". {26} " ) p2 = re . compile ( ".." ) args = [ p2 . findall ( x ) for x in p1 . findall ( hand_string )] if len ( args ... ... 。この属性が設定されていて、関数が異なる数の式で呼び出された場合、 TypeError が発生します。デフォルトは None です。 as_sql ( compiler , connection , function = None , template = None , arg_joiner = None , ** extra_context ) [ソース] データベース関数の SQL ... べきです。例えば: django/db/models/functions.py class ConcatPair ( Func ): ... function = "CONCAT" ... def as_mysql ( self , compiler , connection , ** extra_context ): return super () . as_sql ( compiler , connection , function = "CONCAT_WS" , template = ... ( query , allow_joins , reuse , summarize , for_save ) return c 次に、SQLを生成するメソッドを書きます: def as_sql ( self , compiler , connection , template = None ): sql_expressions , sql_params = [], [] for expression in self . expressions : sql , para ... ... ionError が発生します。 regex re.search() を使用して、指定された value 内を検索する正規表現パターンです。これは文字列か re.compile() で作成されたコンパイル済みの正規表現です。 デフォルトは空文字列で、すべての value から検索されます。 message バリデーショ ... ... .ExceptionReporter subclass to customize the traceback text sent to site ADMINS when DEBUG is False . 管理コマンド The new compilemessages --ignore option allows ignoring specific directories when searching for .po files to compile. showmigrations --lis ... ... igns_in_column_aliases feature flag is removed. The DatabaseOperations.binary_placeholder_sql() method now expects a query compiler as an extra positional argument and should return a two-elements tuple composed of an SQL format string and a tuple of as ... ing JSONField is now deprecated in favor of the new JSONNull expression. At the end of the deprecation period, None values compile to SQL IS NULL when used as the top-level value. Key and index lookups are unaffected by this deprecation. The undocumente ... L format string and a tuple of associated parameters. This method should now expect to be provided expressions meant to be compiled via the provided compiler argument. The quote_name_unless_alias() method of SQLCompiler , the type of object passed as th ... 2026年10月08日