Opened 8 years ago
Last modified 8 years ago
#28175 closed Bug
__in query on parent model no longer works in 1.11 — at Initial Version
| Reported by: | Daniel Keller | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.11 |
| Severity: | Release blocker | Keywords: | |
| Cc: | Mariusz Felisiak, Simon Charette | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I have models
class Place(models.Model):
pass
class Community(Place):
place_ptr = models.OneToOneField(Place, parent_link=True, on_delete=models.CASCADE,
primary_key=True, serialize=False, related_name='+')
class Potential(models.Model):
community = models.ForeignKey(Community, on_delete=CASCADE)
and in 1.10 I can do
Potential.objects.filter(community__in=Place.objects.all())
but in 1.11 this fails with
django.core.exceptions.FieldError: Cannot resolve keyword 'place_ptr' into field. Choices are: [...]
In both versions
Potential.objects.filter(community=Place.objects.first())
works fine.
It's not clear to me from the docs whether the 1.10 behavior was intended, though.
Note:
See TracTickets
for help on using tickets.