Fix version ordering
exonian opened this issue · 9 comments
Because they're just string ordered, the newly-imported 1.10
will appear below all the others.
This will make lists (like the dropdown in the navbar, maybe others I can't think of right now) look weird but it also breaks the automatic detection of the latest version, so 1.9
will be used by default still.
Confirmed. This is happening live.
ProjectVersion.objects.get_latest()
will also need a look.
Huh, yeah; I'd forgotten that didn't use default ordering.
One option here is the natsort lib for doing this in-memory with Python.
Yeah that or use StrictVersion from distutils as the key to sort/sorted.
I'd kinda prefer to avoid doing it this way, as it feels nice to be able to not have to do anything custom beyond defining the field to order_by
, but maybe the denorm of adding a computed string-sortable field isn't worth it.
Of course, as long as we're strict about setting it in the fixtures, we could just order them by PK...
Why isn't 🙀 one of the default reactions!? ;)
Another possibility could have been to sort be release date, but the solution merged is fine.
Huh, I don't think I'd even know how to go about getting that non-manually!
And it might not even be quite what we wanted, if we ever re-imported an LTS after the next version had come along, or something like that.
But mostly I didn't think of it :)