Hi all,
I have 2 models.

class Story(models.Model):
    title = models.CharField(maxlength=150,core=True)
 .....
    counter =
models.ForeignKey(ClickCounter,edit_inline=models.STACKED,num_in_admin=0,blank=True,null=True)

class ClickCounter(models.Model):
    number_views = models.IntegerField(default=0)
    number_comments = models.IntegerField(default=0)

I want to extract all Story objects order by number_views ClickCounter
field.
I tried with this:

more_seen =
Story.objects.select_related().order_by('counters_clickcounter.number_views','-
title')[0:10]

but, the result is that not work.
(1054, "Unknown column 'counters_clickcounter.number_views' in 'order
clause'")

In my db the tables are: stories_story and counters_clickcounter and
the field number_views exists in table counters_clickcounter.
I use last trunk of Django (0.97) and the db is MySql.

Thanks.

Marco


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to