I have a string of sort keys which I've generated dynamically using the name of the table (model) that I'm trying to retrieve elements from, while putting them in a pre-determined sort order. The original sort key string looks like this:
domain_code,request_url,request_description,id,request_method,response_type Then I do some string manipulation of the "sort_keys" string object to produce this second version of the string: 'domain_code','request_url','request_description','id','request_method','response_type' to be used for the "sort_keys" of the Queryset "order_by" option. I'm coding the Queryset with the "order_by" option like this: tblEntryLst = table_class.objects.order_by(sort_keys) which fails with a django.core.exceptions.FieldError. But if I code it the exact same way and hard-code the "sort_keys" like this: tblEntryLst = table_class.objects.order_by('domain_code','request_url','request_description','id','request_method','response_type') Then everything works. I'm thinking the reason it fails in the first instance is because the sort_keys object is maybe being evaluated before the Queryset command is actually run and so at that point the "sort_keys" are no longer in the proper comma-separated string object format to work within the confines of the command. And in the second case the Queryset command does work because the sort-keys aren't evaluated before the command is actually run. I hope this makes sense, and would appreciate any help in getting this to work without having to resort to hard-coding my sort keys, instead of using the dynamic ones. Thanks for the help. Henry -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d5721e7f-9525-428c-a4cc-d76d5577189c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.