From 738720aa94a71508c4437366cf48a867505f4bdb Mon Sep 17 00:00:00 2001 From: James Pulec Date: Tue, 15 Dec 2020 17:39:05 -0800 Subject: [PATCH 1/2] Fix for Reverse Manager `update_or_create` calls This attr list appears to be missing `update_or_create` which means that reverse related managers throw an error when trying to use them like `self..update_or_create()`. --- pylint_django/augmentations/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pylint_django/augmentations/__init__.py b/pylint_django/augmentations/__init__.py index 473ebc80..427a37ef 100644 --- a/pylint_django/augmentations/__init__.py +++ b/pylint_django/augmentations/__init__.py @@ -44,6 +44,7 @@ 'extra', 'get', 'get_or_create', + 'update_or_create', 'get_queryset', 'create', 'bulk_create', From 7e0550a2b7964583dfd1a40e6e743463ede156a3 Mon Sep 17 00:00:00 2001 From: James Pulec Date: Mon, 28 Dec 2020 15:10:32 -0800 Subject: [PATCH 2/2] Add Reverse Related Manager Test --- pylint_django/tests/input/func_noerror_foreign_key_sets.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pylint_django/tests/input/func_noerror_foreign_key_sets.py b/pylint_django/tests/input/func_noerror_foreign_key_sets.py index 22ce18bc..a5cfeb3a 100644 --- a/pylint_django/tests/input/func_noerror_foreign_key_sets.py +++ b/pylint_django/tests/input/func_noerror_foreign_key_sets.py @@ -15,6 +15,9 @@ def get_others(self): def get_first(self): return self.othermodel_set.first() + def othermodel_update_or_create(self): + return self.othermodel_set.update_or_create() + class OtherModel(models.Model): count = models.IntegerField()