From db1edeeabf45906320fe0118626c3282ae0d7b60 Mon Sep 17 00:00:00 2001 From: PIG208 <39874143+PIG208@users.noreply.github.com> Date: Mon, 8 Aug 2022 17:18:08 -0400 Subject: [PATCH] Fix a broken test case after the Django 4.1 update. (#1093) This fixes the CI starting occur on #1086 and following PRs due to the release of Django 4.1 (https://docs.djangoproject.com/en/4.1/releases/4.1/) which shipped the change # Even if this relation is not to pk, we require still pk value. # The wish is that the instance has been already saved to DB, # although having a pk value isn't a guarantee of that. if self.instance.pk is None: raise ValueError( f"{instance.__class__.__name__!r} instance needs to have a primary " f"key value before this relationship can be used." ) in https://github.com/django/django/pull/15318. --- tests/typecheck/fields/test_related.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/typecheck/fields/test_related.yml b/tests/typecheck/fields/test_related.yml index 50410d52e..b3b12dcf2 100644 --- a/tests/typecheck/fields/test_related.yml +++ b/tests/typecheck/fields/test_related.yml @@ -654,6 +654,7 @@ pass TransactionManager = BaseManager.from_queryset(TransactionQuerySet) class Transaction(models.Model): + pk = 0 objects = TransactionManager() def test(self) -> None: self.transactionlog_set