I found this patch which fixes it. I've been using it for a while now:
http://code.djangoproject.com/ticket/2210

Honza Král wrote:
> this works fine, but if you forget the select_related() it will result
> in a cross join which is probably the last thing you want from your
> database...
>
> I was bitten by this when I specified this sort of ordering in the model...
>
> On 1/13/07, gordyt <[EMAIL PROTECTED]> wrote:
> >
> > Hi Carole,
> >
> > There is a workaround for this problem.  I am using the latest
> > subversion build of django, so I don't know if it works with the last
> > official build or not.
> >
> > Here is an example:
> >
> > ProductVersion.objects.select_related().order_by("kindledb_product.name","version_number")
> >
> > Here are the model definitions:
> >
> > class ProductVersion(models.Model):
> >     product=models.ForeignKey(Product)
> >     version_number=models.CharField(maxlength=16)
> >     availability_date=models.DateField(null=True,blank=True)
> >     release_notes=models.TextField(blank=True)
> >
> > class Product(models.Model):
> >     name=models.CharField(maxlength=128)
> >
> >
> > Note that kindledb_product is the name of the database table that
> > stores the information from the Product.
> >
> > --gordon
> >
> >
> > >
> >
>
>
> --
> Honza Král
> E-Mail: [EMAIL PROTECTED]
> ICQ#:   107471613
> Phone:  +420 606 678585


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