... ss)s' を含めることができ、これにより小文字化されたアプリラベルと具体モデルのクラス名に置き換えられます。 CheckConstraint ( condition = Q ( age__gte = 18 ), name = " %(app_label)s _ %(class)s _is_adult" ) 制約のバリデーション 制約は モデルのバリデーション ... ationError を発生させます。 このメソッドはサブクラスで実装する必要があります。 CheckConstraint class CheckConstraint ( * , condition , name , violation_error_code = None , violation_error_message = None ) [ソース] データベースにチェック制約を作成します。 ... condition CheckConstraint. condition 制約が強制する条件チェックを指定する Q オブジェクトまたは真偽値の Expression です。 例: CheckConstraint ( condition = Q ( ... ... -Modified ヘッダを提供できます。これらのヘッダは HTTP レスポンス上ではオプションです。ヘッダはビュー関数で設定することも、 ConditionalGetMiddleware ミドルウェアを使用して ETag ヘッダを設定してもらうこともできます。 When the client next requests the same r ... epending on the header, if the page has been modified or does not match the ETag sent by the client, a 412 status code (Precondition Failed) may be returned. より細かい粒度のコントロールが必要な場合には、ビューごとの条件付き処理関数を使えます。 condition ... に対して、コンテンツが前回のリクエスト以降変更されていないことを伝えます。 これら 2 つの関数は django.views.decorators.http.condition デコレータのパラメータとして渡されます。このデコレータは、HTTP リクエストのヘッダがリソースのヘッダと一致するかどうかを調べ ... ... lusionConstraint ( * , name , expressions , index_type = None , condition = None , deferrable = None , include = None , violation_error_code = None , violation_error_message = None ) [ソース] デー ... d, the default index type is GIST . Changed in Django 6.1: Support for exclusion constraints using Hash indexes was added. condition ExclusionConstraint. condition 行の一部に制約をかける条件を指定する Q オブジェクト。たとえば、 condition=Q(cancelled=False ... ) 。 これらの条件は、 django.db.models.Index.condition と同じデータベースの制約事項を持ちます。 deferrable ExclusionConstraint. deferrable 遅延可能な排他制約を作成するには、この ... ... 習です。 Index オプション class Index ( * expressions , fields = () , name = None , db_tablespace = None , opclasses = () , condition = None , include = None ) [ソース] データベース内にインデックス (B-Tree) を作成します。 expressions Index. expressions 位置 ... を作成します。 opclasses はPostgreSQL以外のデータベースでは無視されます。 opclasses を使用する場合、 Index.name が必要です。 condition Index. condition テーブルが非常に大きくて、ほとんどクエリが行のサブセットを対象としている場合、インデックスをそのサブセット ... に制限すると役に立つかもしれません。条件を Q として指定してください。たとえば、 condition=Q(pages__gt=400) は、400ページ以上あるレコードにインデックスを作成します。 condition を使用する場合、 Index.name が必要です ... ... expression. Conditional expressions can also be combined and nested like other expressions . 条件式クラス このページの例では、以下のモデルを使用 ... ount_type = models . CharField ( max_length = 1 , choices = ACCOUNT_TYPE_CHOICES , default = REGULAR , ) When class When ( condition = None , then = None , ** lookups ) [ソース] When() オブジェクトは、条件式で使用する条件とその結果をカプセル化するために使 ... LD , then = "name" ) >>> When ( account_type = Client . GOLD , then = F ( "name" )) >>> # You can use field lookups in the condition >>> from datetime import date >>> When ( ... registered_on__gt = date ( 2014 , 1 , 1 ), ... registered_on__lt = date ( 201 ... ... ne ( #30330 ). Prevented makemigrations from generating infinite migrations for check constraints and partial indexes when condition contains a range object ( #30350 ). Reverted an optimization in Django 2.2 ( #29725 ) that caused the inconsistent behavio ... eir case-insensitive variant) ( #30408 ). Fixed a migration crash on Oracle and SQLite when adding a check constraint with condition contains | ( OR ) operator ( #30412 ). ... ... crafted user input ( #26325 ). Fixed a race condition in BaseCache.get_or_set() ( #26332 ). It now returns the default value instead of False if there's an error when trying to ... ... s HandField ( models . Field ): # ... def formfield ( self , ** kwargs ): # Exclude the field from the ModelForm when some condition is met. some_condition = kwargs . get ( "some_condition" , False ) if some_condition : return None # Set up some defaults ... ... go 3.2 where a system check would crash on a reverse one-to-one relationships in CheckConstraint.check or UniqueConstraint.condition ( #32635 ). Fixed a regression in Django 3.2 that caused a crash of ModelAdmin.search_fields when searching against phrase ... ... 件付きのビュー処理 django.views.decorators.http にある以下のデコレータを使って、特定のビューのキャッシュ動作を制御できます。 condition ( etag_func = None , last_modified_func = None ) [ソース] conditional_page () このデコレータを使用すると、ビューに Conditi ... 2026年10月08日