... uerysets combined with the | operator ( #32717 ). Fixed a regression in Django 3.2.1 where saving FileField would raise a SuspiciousFileOperation even when a cu ... ... ressions as right-hand sides. The new OpClass() expression allows creating functional indexes on expressions with a custom operator class. See Functional indexes for more details. django.contrib.sitemaps The new Sitemap attributes alternates , languages ... and covering unique constraints on PostgreSQL 11+. The new UniqueConstraint.opclasses attribute allows setting PostgreSQL operator classes. The QuerySet.update() method now respects the order_by() clause on MySQL and MariaDB. FilteredRelation() now supp ... raised ValidationError . This allows custom error messages to use the %(value)s placeholder. The ValidationError equality operator now ignores messages and params ordering. Backwards incompatible changes in 3.2 データベースバックエンド API このセクション ... ... ion , name ) [ソース] OpClass() 式は、機能インデックス、機能ユニーク制約、または除外制約を定義するために使用できるカスタム operator class と一緒に表す expression を表します。これを使用するには、 INSTALLED_APPS に 'django.contrib.postgres' を追加する必要が ... あります。 name パラメータを operator class の名前に設定します。 例: Index ( OpClass ( Lower ( "username" ), name = "varchar_pattern_ops" ), name = "lower_usern ... xclusionConstraint ( name = "exclude_overlapping_ops" , expressions = [ ( OpClass ( "circle" , name = "circle_ops" ), RangeOperators . OVERLAPS ), ], ) これは circle_ops を使用して circle 上に排他制約を作成します。 ... ... w be serialized in migrations. You can now register custom serializers for migrations. モデル Added support for PostgreSQL operator classes ( Index.opclasses ). Added support for partial indexes ( Index.condition ). Added the NullIf and Reverse database ... es TypeError: Cannot assign the same cached_property to two different names ('base' and 'alias'). Use this instead: import operator class A : ... alias = property ( operator . attrgetter ( "base" )) Permissions for proxy models Permissions for proxy mode ... ... ) ( #30408 ). Fixed a migration crash on Oracle and SQLite when adding a check constraint with condition contains | ( OR ) operator ( #30412 ). ... ... eField and DecimalRangeField allows specifying bounds for list and tuple inputs. ExclusionConstraint now allows specifying operator classes with the OpClass() expression. django.contrib.sitemaps The default sitemap index template <sitemapindex> now inclu ... n older versions, no prefetching was done. Q objects and querysets can now be combined using ^ as the exclusive or ( XOR ) operator. XOR is natively supported on MariaDB and MySQL. For databases that do not support XOR , the query will be converted to an ... ... は式または文字列。2番目の要素は文字列で表現された SQL 演算子です。タイプミスを避けるために、演算子を文字列でマップする RangeOperators を使用できます。たとえば: expressions = [ ( "timespan" , RangeOperators . ADJACENT_TO ), ( F ( "room" ), RangeOperators . ... EQUAL ), ] 演算子の制約 排他制約には可換演算子のみ使用できます。 OpClass() 式は、制約式のカスタム operator class を指定するために使用できます。たとえば: expressions = [ ( OpClass ( "circle" , name = "circle_ops" ), RangeOperators ... す。例: from django.contrib.postgres.constraints import ExclusionConstraint from django.contrib.postgres.fields import RangeOperators from django.db.models import Deferrable ExclusionConstraint ( name = "exclude_overlapping_deferred" , expressions = [ ( " ... ... y CharField , FileField , and TextField ), then Django will create an additional index that uses an appropriate PostgreSQL operator class for the column. The extra index is necessary to correctly perform lookups that use the LIKE operator in their SQL, a ... ... clude と同じデータベース制約を持ちます。 opclasses UniqueConstraint. opclasses この一意なインデックスに使用する PostgreSQL operator クラス の名前です。カスタム演算子クラスが必要な場合は、インデックスの各フィールドに1つずつ指定しなければなりません。 例: U ... ... (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 fields. As an example it is possible to add day_lte operator for DateFields . The django.db.models.Transform cl ... ward relation for OneToOneField by setting its related_name to '+' or ending it with '+' . F expressions support the power operator ( ** ). The remove() and clear() methods of the related managers created by ForeignKey and GenericForeignKey now accept th ... 2026年10月08日