-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
pylint_django/tests/input/external_model_utils_noerror_override_manager.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# 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 | ||
# pylint: disable=missing-docstring | ||
|
||
from model_utils.managers import InheritanceManager | ||
|
||
from django.db import models | ||
|
||
|
||
class BaseModel(models.Model): | ||
name = models.CharField() | ||
|
||
|
||
class BuggyModel(models.Model): | ||
objects = InheritanceManager() | ||
|
||
name = models.CharField() | ||
|
||
|
||
def function(): | ||
for record in BaseModel.objects.all(): | ||
print(record.name) | ||
|
||
for record in BuggyModel.objects.all(): | ||
print(record.name) |
2 changes: 2 additions & 0 deletions
2
pylint_django/tests/input/external_model_utils_noerror_override_manager.rc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[testoptions] | ||
requires = django-model-utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters