You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm afraid this would be quite complex to achieve, as the ordering is performed on the database side, that doesn't know about semantic versioning...
This might become possible with future versions of Django, which will include better support for custom fields (e.g PostgreSQL-specific ones, where http://pgxn.org/dist/semver/doc/semver.html could be used).
In the meanwhile, you can use sorted(my_qs, key=lambda o: o.version).
Hello
1 - Create a Django model containing a VersionField, and insert values with different versions
2 - Use an order_by clause ordering by the VersionField field
3 - The ordering is done as text, not as version numbers
One example of ordering (this is with reverse ordering): [Version('1.2.3'), Version('1.10.3'), Version('1.0.3')]
Regards
The text was updated successfully, but these errors were encountered: