... でマップする RangeOperators を使用できます。たとえば: expressions = [ ( "timespan" , RangeOperators . ADJACENT_TO ), ( F ( "room" ), RangeOperators . EQUAL ), ] 演算子の制約 排他制約には可換演算子のみ使用できます。 OpClass() 式は、制約式のカスタム ope ... stgres.fields import DateTimeRangeField , RangeOperators from django.db import models from django.db.models import Q class Room ( models . Model ): number = models . IntegerField () class Reservation ( models . Model ): room = models . ForeignKey ( " ... ionConstraint ( name = "exclude_overlapping_reservations" , expressions = [ ( "timespan" , RangeOperators . OVERLAPS ), ( "room" , RangeOperators . EQUAL ), ], condition = Q ( cancelled = False ), ), ] モデルが2つのフィールドを使用して範囲を定義する場 ... ... でマップする RangeOperators を使用できます。たとえば: expressions = [ ( "timespan" , RangeOperators . ADJACENT_TO ), ( F ( "room" ), RangeOperators . EQUAL ), ] 演算子の制約 排他制約には可換演算子のみ使用できます。 OpClass() 式は、制約式のカスタム ope ... stgres.fields import DateTimeRangeField , RangeOperators from django.db import models from django.db.models import Q class Room ( models . Model ): number = models . IntegerField () class Reservation ( models . Model ): room = models . ForeignKey ( " ... ionConstraint ( name = "exclude_overlapping_reservations" , expressions = [ ( "timespan" , RangeOperators . OVERLAPS ), ( "room" , RangeOperators . EQUAL ), ], condition = Q ( cancelled = False ), ), ] モデルが2つのフィールドを使用して範囲を定義する場 ... ... 頭辞を含む) または式 (もしくは文字列および/または式のタプルもしくはリスト)。 ArrayAgg.order_by と同じ例です。 使用例: class Room ( models . Model ): number = models . IntegerField ( unique = True ) class HotelReservation ( models . Model ): room = mod ... els . ForeignKey ( "Room" , on_delete = models . CASCADE ) start = models . DateTimeField () end = models . DateTimeField () requirements = models ... . JSONField ( blank = True , null = True ) >>> from django.contrib.postgres.aggregates import JSONBAgg >>> Room . objects . annotate ( ... requirements = JSONBAgg ( ... "hotelreservation__requirements" , ... order_by = "-hotelreservat ... ... 頭辞を含む) または式 (もしくは文字列および/または式のタプルもしくはリスト)。 ArrayAgg.order_by と同じ例です。 使用例: class Room ( models . Model ): number = models . IntegerField ( unique = True ) class HotelReservation ( models . Model ): room = mod ... els . ForeignKey ( "Room" , on_delete = models . CASCADE ) start = models . DateTimeField () end = models . DateTimeField () requirements = models ... . JSONField ( blank = True , null = True ) >>> from django.contrib.postgres.aggregates import JSONBAgg >>> Room . objects . annotate ( ... requirements = JSONBAgg ( ... "hotelreservation__requirements" , ... order_by = "-hotelreservat ... ... UniqueConstraint. fields ¶ 制約を適用したい一意な列のセットを表すフィールド名のリスト。 例: UniqueConstraint ( fields = [ "room" , "date" ], name = "unique_booking" ) それぞれの部屋がそれぞれの日付で1度だけ予約できることを保証します。 condition ¶ Uni ... ( fields ) クエリにインデックスだけのスキャンを使用できます。 例: UniqueConstraint ( name = "unique_booking" , fields = [ "room" , "date" ], include = [ "full_name" ]) この設定では、 room と date によるフィルタリング、 full_name の SELECT の際にデータ ... ... UniqueConstraint. fields ¶ 制約を適用したい一意な列のセットを表すフィールド名のリスト。 例: UniqueConstraint ( fields = [ "room" , "date" ], name = "unique_booking" ) それぞれの部屋がそれぞれの日付で1度だけ予約できることを保証します。 condition ¶ Uni ... ( fields ) クエリにインデックスだけのスキャンを使用できます。 例: UniqueConstraint ( name = "unique_booking" , fields = [ "room" , "date" ], include = [ "full_name" ]) この設定では、 room と date によるフィルタリング、 full_name の SELECT の際にデータ ... ... ロックの内容が表示されます: {% if athlete_list %} Number of athletes: {{ athlete_list | length }} {% elif athlete_in_locker_room_list %} Athletes should be out of the locker room soon! {% else %} No athletes. {% endif %} 上記の場合、 athlete_list が空 ... でなければ、 {{ athlete_list|length }} 変数によって選手の数が表示されます。もし athlete_in_locker_room_list が空でなければ、"Athletes should be out... " というメッセージが表示されます。両方のリストが空の場合、"No athletes." と ... ... ロックの内容が表示されます: {% if athlete_list %} Number of athletes: {{ athlete_list | length }} {% elif athlete_in_locker_room_list %} Athletes should be out of the locker room soon! {% else %} No athletes. {% endif %} 上記の場合、 athlete_list が空 ... でなければ、 {{ athlete_list|length }} 変数によって選手の数が表示されます。もし athlete_in_locker_room_list が空でなければ、"Athletes should be out... " というメッセージが表示されます。両方のリストが空の場合、"No athletes." と ... ... ブロックの内容を出力します: {% if athlete_list %} Number of athletes: {{ athlete_list | length }} {% elif athlete_in_locker_room_list %} Athletes should be out of the locker room soon! {% else %} No athletes. {% endif %} 上の例では、 athlete_list が空 ... ... ブロックの内容を出力します: {% if athlete_list %} Number of athletes: {{ athlete_list | length }} {% elif athlete_in_locker_room_list %} Athletes should be out of the locker room soon! {% else %} No athletes. {% endif %} 上の例では、 athlete_list が空 ... 2026年10月08日