... 、明示的に正しいデータベース型にキャストされない限り、不正な型に変換される可能性があります: >>> from django.db.models import DateTimeField >>> from django.db.models.functions import Cast , Coalesce >>> from django.utils import timezone >>> now = timezone . now ... () >>> Coalesce ( "updated" , Cast ( now , DateTimeField ())) Collate ¶ class Collate ( expression , collation ) [ソース] ¶ クエリに使用する式と照合順序名 (collation name) を指定し ... するとデータベースエラーになります。 使用例: class Blog ( models . Model ): body = models . TextField () modified = models . DateTimeField ( auto_now = True ) class Comment ( models . Model ): body = models . TextField () modified = models . DateTimeField ( aut ... ... 、明示的に正しいデータベース型にキャストされない限り、不正な型に変換される可能性があります: >>> from django.db.models import DateTimeField >>> from django.db.models.functions import Cast , Coalesce >>> from django.utils import timezone >>> now = timezone . now ... () >>> Coalesce ( "updated" , Cast ( now , DateTimeField ())) Collate ¶ class Collate ( expression , collation ) [ソース] ¶ クエリに使用する式と照合順序名 (collation name) を指定し ... するとデータベースエラーになります。 使用例: class Blog ( models . Model ): body = models . TextField () modified = models . DateTimeField ( auto_now = True ) class Comment ( models . Model ): body = models . TextField () modified = models . DateTimeField ( aut ... ... ogentry>, <django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: password>, <django.db.models.fields.DateTimeField: last_login>, <django.db.models.fields.BooleanField: is_superuser>, <django.db.models.fields.CharField: username>, <django ... ango.db.models.fields.BooleanField: is_staff>, <django.db.models.fields.BooleanField: is_active>, <django.db.models.fields.DateTimeField: date_joined>, <django.db.models.fields.related.ManyToManyField: groups>, <django.db.models.fields.related.ManyToManyField ... ogentry>, <django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: password>, <django.db.models.fields.DateTimeField: last_login>, <django.db.models.fields.BooleanField: is_superuser>, <django.db.models.fields.CharField: username>, <django ... ... ogentry>, <django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: password>, <django.db.models.fields.DateTimeField: last_login>, <django.db.models.fields.BooleanField: is_superuser>, <django.db.models.fields.CharField: username>, <django ... ango.db.models.fields.BooleanField: is_staff>, <django.db.models.fields.BooleanField: is_active>, <django.db.models.fields.DateTimeField: date_joined>, <django.db.models.fields.related.ManyToManyField: groups>, <django.db.models.fields.related.ManyToManyField ... ogentry>, <django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: password>, <django.db.models.fields.DateTimeField: last_login>, <django.db.models.fields.BooleanField: is_superuser>, <django.db.models.fields.CharField: username>, <django ... ... ような、データベースに直接アクセスできる人のために、フィールドをドキュメント化するのに便利です。例えば: pub_date = models . DateTimeField ( db_comment = "Date and time when the article was published" , ) db_default ¶ Field. db_default ¶ データベースによって計算 ... されるこのフィールドのデフォルト値。これはリテラル値でも、 Now のようなデータベース関数でも構いません: created = models . DateTimeField ( db_default = Now ()) リテラルやデータベース関数から構成する限り、より複雑な式を使用できます: month_due = models . DateFi ... なぜなら unique がインデックスの作成を意味するからです。 unique_for_date ¶ Field. unique_for_date ¶ これを DateField または DateTimeField の名前に設定すると、このフィールドが日付フィールドの値に対して一意であることを要求します。 例えば、 title フィールドに uni ... ... med in UTC. This limitation was lifted in Django 1.6. Use QuerySet.datetimes() to perform time zone aware aggregation on a DateTimeField . Support for savepoints in SQLite ¶ Django 1.6 adds support for savepoints in SQLite, with some limitations . BinaryField ... used to return a list of datetime . QuerySet.datetimes() returns a list of datetime . QuerySet.dates() no longer usable on DateTimeField ¶ QuerySet.dates() raises an error if it's used on DateTimeField when time zone support is active. Use QuerySet.datetimes( ... res time zone definitions ¶ The date_hierarchy feature of the admin now relies on QuerySet.datetimes() when it's used on a DateTimeField . This requires time zone definitions in the database when USE_TZ is True . Learn more . date_list in generic views requir ... ... ような、データベースに直接アクセスできる人のために、フィールドをドキュメント化するのに便利です。例えば: pub_date = models . DateTimeField ( db_comment = "Date and time when the article was published" , ) db_default ¶ Field. db_default ¶ データベースによって計算 ... されるこのフィールドのデフォルト値。これはリテラル値でも、 Now のようなデータベース関数でも構いません: created = models . DateTimeField ( db_default = Now ()) リテラルやデータベース関数から構成する限り、より複雑な式を使用できます: month_due = models . DateFi ... なぜなら unique がインデックスの作成を意味するからです。 unique_for_date ¶ Field. unique_for_date ¶ これを DateField または DateTimeField の名前に設定すると、このフィールドが日付フィールドの値に対して一意であることを要求します。 例えば、 title フィールドに uni ... ... med in UTC. This limitation was lifted in Django 1.6. Use QuerySet.datetimes() to perform time zone aware aggregation on a DateTimeField . Support for savepoints in SQLite ¶ Django 1.6 adds support for savepoints in SQLite, with some limitations . BinaryField ... used to return a list of datetime . QuerySet.datetimes() returns a list of datetime . QuerySet.dates() no longer usable on DateTimeField ¶ QuerySet.dates() raises an error if it's used on DateTimeField when time zone support is active. Use QuerySet.datetimes( ... res time zone definitions ¶ The date_hierarchy feature of the admin now relies on QuerySet.datetimes() when it's used on a DateTimeField . This requires time zone definitions in the database when USE_TZ is True . Learn more . date_list in generic views requir ... ... 切に加工された delimiter を使った SQL インジェクションが存在しました。 バグ修正 ¶ Subquery() アノテーションから DateField 、 DateTimeField 、あるいは TimeField を減算したときにクラッシュするという Django 3.0 のリグレッションを修正しました ( #31133 )。 クエリセッ ... ェクション 集計 Subquery アノテーション QuerySet values チェック 選択 リリースノート セキュリティ 問題 潜在的 加工 DateField DateTimeField TimeField 減算 クエリ クイック検索 Last update: 2026年10月09日 « previous | up | next » ... ... lass Reservation ( models . Model ): room = models . ForeignKey ( "Room" , on_delete = models . CASCADE ) start = models . DateTimeField () end = models . DateTimeField () cancelled = models . BooleanField ( default = False ) class Meta : constraints = [ Excl ... 2026年10月08日