On 5/1/06, Cheng Zhang <[EMAIL PROTECTED]> wrote:
> I use a custom SELECT column as:
> select = {
> 'choices': 'SELECT COUNT(*) FROM polls_choice WHERE
> poll_id=polls_poll.id',
> }
> p = Poll.objects.extra(select=select).order_by('choices')
>
> By trying this, I found out a bug in the ORM layer
On the models of tutorial 1, I want to get a list of Poll, order by
how many choices it has.
class Poll(models.Model):
question = models.CharField(maxlength=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
poll = models.ForeignKey(Poll)
2 matches
Mail list logo