Skip to content

Commit fcd0f58

Browse files
committed
[refs #58] Merging PR58 and fixing conflicts with previous fix for _locals access
2 parents 4e28bb4 + e38ebbd commit fcd0f58

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

pylint_django/transforms/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def set_fake_locals(module):
2828
for class_name in class_names:
2929
# This changed from locals to _locals between astroid 1.3 and 1.4
3030
if hasattr(module, '_locals'):
31-
module._locals[class_name] = fake._locals[class_name] # pylint: disable=protected-access
31+
module._locals[class_name].extend(fake._locals[class_name]) # pylint: disable=protected-access
3232
else:
33-
module.locals[class_name] = fake.locals[class_name]
33+
module.locals[class_name].extend(fake.locals[class_name])
3434

3535
MANAGER.register_transform(nodes.Module, set_fake_locals)
3636

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
Checks that Pylint does not complain about using Model and Manager methods
3+
"""
4+
# pylint: disable=C0111,W5101,W5103
5+
from django.db import models
6+
7+
8+
class SomeModel(models.Model):
9+
pass
10+
11+
if __name__ == '__main__':
12+
MODEL = SomeModel()
13+
MODEL.save()
14+
MODEL.delete()
15+
16+
COUNT = SomeModel.objects.count()

0 commit comments

Comments
 (0)