Open nkay08 opened 5 years ago
Hi, thanks for the suggestion. The readme does say that order fields must be non-nullable and unique - see Ordering considerations - and in my experience, that hasn't restricted the library's usefulness because I don't think I've ever wanted to order a nullable field. But it does seem like it would be useful. I'm not actively using this lib right now so not sure when I'd get a chance to update it, but very happy to review PRs.
Actually, I did a bit of an experiment on this (see https://github.com/gregplaysguitar/django-next-prev/pull/7) and the problem is the underlying database behaviour when ordering by a nullable field is not consistent. So I'm sure that I can change this. If you have any suggestions, let me know.
Thanks for the feedback. I believe it is possible. I will try some things and if I can pass the tests I will make a PR.
EDIT: I made it work in a hacky kind of way that passes the tests for now. I will refine it
Initially I tried to implement something similar to this module, but then found this and tested it. It works quite good, but I have found two cases where it fails:
instance
isNone
a filter operation similar to (pk
A quick coding to catch these cases:
This was just some code I could quicky come up with. I have some doubts about the second point, it may not be consistent if the queryset is ordered by multiple keys, since I just used
pk