I use the method / function .order_by (); however, I want to dynamically build order_by fields. The problem is that .order_by () is waiting to receive a string or buffer. Thus, I cannot create a list or tuple or object to send a function to. How can I achieve this?
I wanted to do something like:
field_list = [] for field in fields: field_list.append( field ) model.objects.all().order_by( field_list )
???
source share