On 10/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > for example the field 'order' is set to: -publish_date,section > > I know that in my view I can't do this: > > Story.objects.filter(id_site=Site.objects.get_current().id).select_related().order_by(order) > > so...how can I do?
You could use *order.split(',') instead of just order. But now your query is getting very long, so you may want to split it up into multiple lines: qs = Story.objects.filter(id_site=Site.objects.get_current().id) qs = qs.select_related().order_by(*order.split(',')) And that will work even if your order variable's value doesn't contain any commas. -Gul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---