#21434: IN clause not supporting the to_field
-------------------------------------+-------------------------------------
Reporter: berndtj@… | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.5
(models, ORM) | Resolution: fixed
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bmispelon):
* status: new => closed
* cc: bmispelon (added)
* needs_better_patch: => 0
* component: Uncategorized => Database layer (models, ORM)
* needs_tests: => 0
* needs_docs: => 0
* resolution: => fixed
Comment:
Hi,
I can indeed reproduce the issue on the 1.5 branch, using the two
following models:
{{{#!python
from django.db import models
class Foo(models.Model):
foo = models.CharField(max_length=1, db_index=True, unique=True)
class Bar(models.Model):
foo = models.ForeignKey(Foo, to_field='foo')
}}}
With these models, the following code shows the issue: `assert
Bar.objects.filter(foo__in=Foo.objects.all()).count()` (this requires
having created one model of each kind in the database).
Having this code, I was able to track down the commit that fixed this
issue in the master branch (also present in 1.6, as it turns out):
97774429aeb54df4c09895c07cd1b09e70201f7d.
Seeing as this issue is not a regression (and therefore its fix is
unlikely to get backported), I'm going to mark this ticket as `fixed`.
Feel free to reopen the ticket if you think otherwise of course.
Thanks for your report.
--
Ticket URL: <https://code.djangoproject.com/ticket/21434#comment:1>
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/075.b6f2f9436be4d17377373ccb55b51e50%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.