Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25972 closed Bug (fixed)

Filtering a ForeignObject with 'isnull' lookup fails in Django 1.9

Reported by: Tomo Otsuka Owned by: nobody
Component: Database layer (models, ORM) Version: 1.9
Severity: Release blocker Keywords: ForeignObject
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Introduced by this PR:

For example, with the following models:

from django.db import models
class Author(models.Model):
    id = models.IntegerField()
    name = models.CharField()
    class Meta:
        app_label = 'foo'

class Book(models.Model):
    author_id = models.IntegerField()
    author_name = models.CharField()
    author = models.ForeignObject(Author, models.CASCADE, ['author_id', 'author_name'], ['id', 'name'])
    class Meta:
        app_label = 'foo'

Running the following filter:


Will result in:

AttributeError: 'MultiColSource' object has no attribute 'as_sql'
> .../django/db/models/sql/
    365         else:
--> 366             sql, params = node.as_sql(self, self.connection)
    367         if select_format and not self.subquery:

Change History (5)

comment:1 by Tomo Otsuka, 9 years ago

Has patch: set

comment:3 by Tim Graham, 9 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:4 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 8b6974a:

Fixed #25972 -- Restored support for the isnull lookup with ForeignObject.

comment:5 by Tim Graham <timograham@…>, 9 years ago

In bc5eed8f:

[1.9.x] Fixed #25972 -- Restored support for the isnull lookup with ForeignObject.

Backport of 8b6974a6857bdc48ad50bf21527b840c27648891 from master

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