Add default ordering in models #157
nikosmichas
started this conversation in
Ideas
Replies: 1 comment
-
Actually I prefer not to have default ordering on models 99% of the time. The reason is you do pay a small performance penalty for the I find it much better to just remember to order the querysets on the views when I need to do things paginated or otherwise need order. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
It seems that the app models don't have a default order.
I was wondering if it would make sense to add ordering by id as a default in order to have a consistent response when using eg
Friend.objects.requests(user)
in a serializer with pagination.What do you think?
The only change needed would be adding this to all models
source: https://docs.djangoproject.com/en/3.2/ref/models/options/#ordering
I would happily open a PR if you agree with the approach
Beta Was this translation helpful? Give feedback.
All reactions