... 問題を修正しました ( #35344 ). Django 5.0 におけるバグを1つ修正しました。このバグは、 GeneratedField が __contains または __icontains ルックアップに依存しているか、 "%" を含む Value を使用している場合に、マイグレーションがクラッシュする原因になっていました ... ... に弱い解決方法です。なぜなら、ユーザーが著者名の正確な部分文字列を知っている必要があるからです。case-insensitive なマッチ ( icontains ) を利用すれば少しはましになりますが、ほとんど違いはありません。 データベースが持つ高度な比較関数 PostgreSQL を使っている場 ... 英語以外の名前を扱う場合、さらなる改善は アクセントなし比較 を使うことです: >>> Author . objects . filter ( name__unaccent__icontains = "Helen" ) [<Author: Helen Mirren>, <Author: Helena Bonham Carter>, <Author: Hélène Joy>] これには別の問題があります。異な ... ... akemigrations will create a migration to recreate the index with the correct name ( #28051 ). Fixed a crash when using a __icontains lookup on a ArrayField ( #28038 ). EmailMessage の attachments 引数に2値タプルを使用した際のクラッシュを修正しました ( #28 ... ... e__startswith = "What" ) >>> q = q . filter ( pub_date__lte = datetime . date . today ()) >>> q = q . exclude ( body_text__icontains = "food" ) >>> print ( q ) この例ではデータベースに3回アクセスしているように見えますが、実際にアクセスしているのは、最終行 ... on honored' にはマッチしても 'today lennon honored' にはマッチしないことに注意してください。 case-insensitive バージョンの icontains もあります。 startswith と endswith それぞれ starts-with と ends-with 検索を行います。case-insensitive バージョン istartsw ... __pk implies __id__exact LIKE 文の中ではパーセント記号とアンダースコアがエスケープされる LIKE SQL文 ( iexact , contains , icontains , startswith , istartswith , endswith , iendswith ) に相当するフィールドルックアップでは、 LIKE 文で使用される2つの特殊文字 ... ... riends__first_name... ); トランスフォーム(変換)部分(省略可) ( lower__first3chars__reversed など); ルックアップ部分 ( __icontains など)。省略した場合のデフォルトは __exact です。 登録API Django は RegisterLookupMixin を使って、自分自身やそのインスタンス ... ... ... ery into search terms and returns all objects that contain each of them in at least one of search_fields . By default, the icontains lookup is used for text fields. For non-text fields with an explicit lookup (e.g., age__exact ), the specified lookup is u ... L の WHERE 句と等価な処理を行います。 WHERE ( first_name ILIKE '%john winston%' OR last_name ILIKE '%john winston%' ) もし icontains ルックアップを使用したくない場合は、フィールドに追加することで任意のルックアップを使用できます。例えば、 search_fields を ... す。これはフィールドに __<lookup> を追加するのと同等です。 プレフィックス ルックアップ ^ istartswith = iexact @ search None icontains 検索方法をカスタムする必要がある場合は、 ModelAdmin.get_search_results() を使って追加的もしくは代替の検索方法を提供できます ... ... ains hstorefield.has_any_keys hstorefield.has_key hstorefield.has_keys hstorefield.key hstorefield.keys hstorefield.values icontains iendswith iexact in intersects iregex isempty isnull iso_week_day iso_year istartswith isvalid jsonfield.contained_by json ... (Sitemap の属性) i18n() (django.template.context_processors モジュール) i18n_patterns() (django.conf.urls.i18n モジュール) icontains field lookup type id (TaskResult の属性) id_for_label (BoundField の属性) id_for_label() (Widget のメソッド) identify_epsg ... ... する場合は、代わりに hstorefield.contains ルックアップを使用する必要があります。 注釈 キーのトランスフォームは、 contains 、 icontains 、 endswith 、 iendswith 、 iexact 、 regex 、 iregex 、 startswith 、および istartswith ルックアップとも連結できます。 警 ... ... le to write custom lookups and transforms for the ORM. Custom lookups work just like Django's built-in lookups (e.g. lte , icontains ) while transforms are a new concept. The django.db.models.Lookup class provides a way to add lookup operators for model f ... 2026年10月08日