Re: order_by problem passing dynamic parameters

2007-10-31 Thread [EMAIL PROTECTED]
Ok, now it works!! Thanks a lot On 31 Ott, 16:57, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > 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: > > >

Re: order_by problem passing dynamic parameters

2007-10-31 Thread Marty Alchin
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

Re: order_by problem passing dynamic parameters

2007-10-31 Thread [EMAIL PROTECTED]
Hi, I resolver my first problem, but now I've another question... I need to specify in the 'order' field of Widget a list with multiple fields.. for example the field 'order' is set to: -publish_date,section I know that in my view I can't do this:

Re: order_by problem passing dynamic parameters

2007-10-29 Thread Malcolm Tredinnick
On Mon, 2007-10-29 at 09:35 -0700, [EMAIL PROTECTED] wrote: > Hi all, > I need to execute a query with a order_by with some parameters that I > read from another query.. > something like this: > > this is my model: > > class Widget(models.Model): > name =

order_by problem passing dynamic parameters

2007-10-29 Thread [EMAIL PROTECTED]
Hi all, I need to execute a query with a order_by with some parameters that I read from another query.. something like this: this is my model: class Widget(models.Model): name = models.CharField(maxlength=50,core=True) order = models.CharField(maxlength=50,blank=True,null=True)

Re: Order_by problem

2006-11-08 Thread nymbyl
It might be the problem of a tuple with only one item: so instead of this: words.get_list(order_by=('Word')) use this: words.get_list(order_by=('Word',)) It's interpreting ('Word') as ('W', 'o', 'r','d') ergo "unknown column W.." --~--~-~--~~~---~--~~ You

Re: Order_by problem

2006-11-08 Thread serbaut
I dont know what get_list is but this should get you all words in order: words = Word.objects.order_by('Word') http://www.djangoproject.com/documentation/db_api/#order-by-fields --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Order_by problem

2006-11-08 Thread Pythoni
I have this very simple model for a table ... class Word(meta.Model): Word=meta.CharField(maxlength=50) def __repr__(self): return self.Word class META: admin = meta.Admin() . Now when I try: words.get_list(order_by=('Word')) I will get the