MCPcopy
hub / github.com/django/django / Book

Class Book

tests/postgres_tests/test_constraints.py:366–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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),

Callers

nothing calls this directly

Calls 3

CharFieldClass · 0.90
DateFieldClass · 0.90
ForeignKeyClass · 0.90

Tested by

no test coverage detected