Skip to content

Commit 442d575

Browse files
committed
Teach pylint_django that objects.all() is subscriptable. Fix #144
the way we do this is by modifying our transformations to return an empty list instead of None.
1 parent abd1164 commit 442d575

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pylint_django/transforms/transforms/django_db_models.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ def __noop(self, *args, **kwargs):
77
return None
88

99

10+
def __noop_list(self, *args, **kwargs):
11+
"""Just a dumb no-op function to make code a bit more DRY"""
12+
return []
13+
14+
1015
class Model(object):
1116
_meta = None
1217
objects = None
@@ -26,7 +31,7 @@ class Manager(object):
2631
"""
2732
get_queryset = __noop
2833
none = __noop
29-
all = __noop
34+
all = __noop_list
3035
count = __noop
3136
dates = __noop
3237
distinct = __noop

0 commit comments

Comments
 (0)