[Answer]-Custom field ordering in django admin

1👍

By using sorted, you’re converting the queryset to a list. But get_query_set must return a queryset, hence the name: anything that operates on the values returned from that manager will be expecting a QS.

There’s no good reason to do that sort in Python. You should add it to the ORM call:

qs = super(PracticeManager, self).get_query_set().order_by('id')

or even better, set the ordering attribute in the model’s Meta class.

Leave a comment