I am trying to filter my results in ascending order based on my field. But orderby is not working when I use below code. I am receiving unicode and converting it to string. Please help me.
def users(request):
user_list = User.objects.filter(user_type='Customer')
#sort by
if request.GET.get('sortby'):
user_list.order_by(str(request.GET.get('sortby')))
这是您不“保存”订单的简单情况吗?
user_list = user_list.order_by(str(request.GET.get('sortby')))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.