| 364 | app_label = "postgres_tests" |
| 365 | |
| 366 | class Book(Model): |
| 367 | title = CharField(max_length=255) |
| 368 | published_date = DateField() |
| 369 | author = ForeignKey(Author, CASCADE) |
| 370 | |
| 371 | class Meta: |
| 372 | app_label = "postgres_tests" |
| 373 | constraints = [ |
| 374 | ExclusionConstraint( |
| 375 | name="exclude_check", |
| 376 | expressions=[ |
| 377 | (F("title"), RangeOperators.EQUAL), |
| 378 | (F("published_date__year"), RangeOperators.EQUAL), |
| 379 | ("published_date__month", RangeOperators.EQUAL), |
| 380 | (F("author__name"), RangeOperators.EQUAL), |
| 381 | ("author__alias", RangeOperators.EQUAL), |
| 382 | ("nonexistent", RangeOperators.EQUAL), |
| 383 | ], |
| 384 | ) |
| 385 | ] |
| 386 | |
| 387 | self.assertCountEqual( |
| 388 | Book.check(databases=self.databases), |
nothing calls this directly
no test coverage detected