Opened 10 years ago
Closed 10 years ago
#23721 closed Bug (fixed)
check_related_objects should not call __iter__
Reported by: | Collin Anderson | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a model with a file-like instance, and I can't have the related query checker (#14334) calling its iter method.
class FileModel(models.Model): def __iter__(self): # tries to open a file and iterate over its lines. class MyModel(models.Model): file = models.ForeignKey(FileModel): filelike = FileModel.objects.first() MyModel.objects.filter(file=filelike) # check_related_objects tries to call __iter__
Change History (2)
comment:1 by , 10 years ago
Has patch: | set |
---|
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
https://github.com/django/django/pull/3431