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 = models.CharField(maxlength=50,core=True) > .... > order = models.CharField(maxlength=50,blank=True,null=True) > > and this is my view : > > temp_list = > Story.objects.filter(id_section=section_id).select_related().order_by(widget.order) > > i have this error: > OperationalError at / > no such column: stories_story. > > for example, if I make this: > order = '-title' > temp_list = > Story.objects.filter(id_section=section_id).select_related().order_by(order) > > it works (but it isn't whar i need...)!!
What you don't tell us is what the value of widget.order is when you get the error. It must be a string that can be validly passed to order_by() and it looks like it doesn't have the right value. So have a look in that direction -- check that widget.order has a sensible value. Regards, Malcolm -- I don't have a solution, but I admire your problem. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---