#25972: Filtering a ForeignObject with 'isnull' lookup fails in Django 1.9
----------------------------------------------+---------------------------
     Reporter:  tomo-otsuka                   |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.9
     Severity:  Normal                        |   Keywords:  ForeignObject
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+---------------------------
 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:
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25972>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.e2a4cede602d82db9ba12c92dfeaaeb6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to