[Answered ]-Change order ModelChoiceField

1👍

Add another field that describes the ordering you want, and order by it.

1👍

You can use extra:

q = Entry.objects.extra(select={'my_sort_field': 
                                "some think like ___
                                    FIND_IN_SET( left(somefield,1),'c,a,d,b')  "})
q = q.extra(order_by = ['my_sort_field'])

But, if was this my model, I will create a new field intended for sort operations and I will keep it overwriting save() method or by signals.

Leave a comment