Skip to content

Commit

Permalink
Add test for #144
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Apr 5, 2018
1 parent 4fe6049 commit 7853e62
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Check that when overriding the 'objects' attribite of a model class
# with a manager from the django-model-utils package pylint-django
# does not report not-an-iterator error
# does not report not-an-iterator error, see
# https://github.com/PyCQA/pylint-django/issues/117
# pylint: disable=missing-docstring

from model_utils.managers import InheritanceManager
Expand Down
20 changes: 20 additions & 0 deletions pylint_django/tests/input/func_noerror_model_objects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Test that defining `objects` as a regular model manager
# doesn't raise issues, see
# https://github.com/PyCQA/pylint-django/issues/144
#
# pylint: disable=missing-docstring

from django.db import models


class ModelWithRegularManager(models.Model):
objects = models.Manager()

name = models.CharField()


def function():
record = ModelWithRegularManager.objects.all()[0]

for record in ModelWithRegularManager.objects.all():
print(record.name)

0 comments on commit 7853e62

Please sign in to comment.