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:2 by Anssi Kääriäinen <akaariai@…>, 10 years ago

Resolution: fixed
Status: newclosed

In ae7cb992bca5d211c9456487feb21b84387006eb:

Fixed #23721 -- check_related_objects without calling iter

Refs #14334

Note: See TracTickets for help on using tickets.
Back to Top