#9968 closed (fixed)
filter/exclude are broken on OneToOneField with primary_key=True
Reported by: | gregoire | Owned by: | Malcolm Tredinnick |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | ||
Cc: | gregoire@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I would expect the following test to work :
from django.db import models class Test(models.Model): """ >>> Test.objects.create() <Test: Test object> """ class Test_A(models.Model): """ >>> Test.objects.filter(test_a=None) [<Test: Test object>] >>> Test.objects.exclude(test_a=None) [] """ model = models.OneToOneField(Test, primary_key=True) class Test_B(models.Model): """ >>> Test.objects.filter(test_b=None) [<Test: Test object>] >>> Test.objects.exclude(test_b=None) [] """ model = models.OneToOneField(Test)
The only difference between Test_A and Test_B is the primary_key set on teh OneToOneField.
Test_A is broken : wrong result when using filter(), IndexError exception when using exclude()
Tested on r9701.
Change History (4)
comment:1 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Fixed in r9979 (I made a typo in the commit message).