Meta ordering on foreign key field which can be None
|Reported by:||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 8 years ago by
|Patch needs improvement:||unset|