#25972 closed Bug (fixed)
Filtering a ForeignObject with 'isnull' lookup fails in Django 1.9
Description ¶
Introduced by this PR: https://github.com/django/django/pull/4036
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:
Book.objects.filter(author__isnull=True).query.__str__()
Will result in:
AttributeError: 'MultiColSource' object has no attribute 'as_sql' > .../django/db/models/sql/compiler.py(366)compile() 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 , 9 years ago
Has patch: | set |
---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
PR: https://github.com/django/django/pull/5858