Meta ordering on foreign key field which can be None
|Reported by:||kkulewski@…||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have model A which links to model B (using field b, but A.b can be None). In Meta of A I have ordering set to b.
AFAIK simple A.objects.all() select query contains INNER JOIN (in this case I use sqlite, but probably this problem is more popular) with relation B so if for some instance of A, A.b is None then it will be not included in the results of A.objects.all().
Change History (5)
comment:1 Changed 6 years ago by Rudolph
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:4 Changed 6 years ago by mtredinnick
- Resolution set to fixed
- Status changed from new to closed