业务场景:
mysql 查询
select * from dormitory_applysettleorder order by FIELD(status,40) desc
django 实现:
ordering = 'FIELD(`status`, 40)'
queryset = queryset.extra(
select={'ordering': ordering}, order_by=('-ordering',))
业务场景:
select * from dormitory_applysettleorder order by FIELD(status,40) desc
ordering = 'FIELD(`status`, 40)'
queryset = queryset.extra(
select={'ordering': ordering}, order_by=('-ordering',))