Re: order_by not working with foreign keys:

2007-02-02 Thread Ramiro Morales
On 2/1/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 2/1/07, Michael Radziej <[EMAIL PROTECTED]> wrote: > > > is there a > > > HOWTO somewhere on how to write a test which does the whole model, > > > database sync, etc etc cycle? > > [...] > > [...] > > Django's internal tests are in

Re: order_by not working with foreign keys:

2007-02-01 Thread Michael Radziej
Bram - Smartelectronix: > Michael Radziej wrote: >> Bram - Smartelectronix: >> >> >>> I'll be updating the ticket, but I was wondering when the ticket would >>> be merged with trunk. >> Someone needs to writes tests for this. As soon as this has been >> done, the ticket can be promoted to "ready

Re: order_by not working with foreign keys:

2007-02-01 Thread Bram - Smartelectronix
Michael Radziej wrote: > Bram - Smartelectronix: > > >> I'll be updating the ticket, but I was wondering when the ticket would >> be merged with trunk. > > Someone needs to writes tests for this. As soon as this has been > done, the ticket can be promoted to "ready for checkin", which means >

Re: order_by not working with foreign keys:

2007-02-01 Thread Michael Radziej
Bram - Smartelectronix: > I'll be updating the ticket, but I was wondering when the ticket would > be merged with trunk. Someone needs to writes tests for this. As soon as this has been done, the ticket can be promoted to "ready for checkin", which means added core developer attention ;-)

Re: order_by not working with foreign keys:

2007-02-01 Thread Bram - Smartelectronix
Michael Radziej wrote: > Hi, > > there's a ticket with a patch about the order_by-Problem: > > http://code.djangoproject.com/ticket/2210. > > Does it help? I just figured out that this problem also exists, even if the name ISN'T different: class Book(models.Model): title =

Re: order_by not working with foreign keys:

2007-01-26 Thread Bram - Smartelectronix
Michael Radziej wrote: > Please report your results in the ticket, I'd appreciate! Done. - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: order_by not working with foreign keys:

2007-01-25 Thread Bram - Smartelectronix
Michael Radziej wrote: > Hi, > > there's a ticket with a patch about the order_by-Problem: > > http://code.djangoproject.com/ticket/2210. > > Does it help? Knowing it's broken helps a LOT :-) I'll try to see if it works w/ the patch. Thanks Michael, - bram

Re: order_by not working with foreign keys:

2007-01-25 Thread Michael Radziej
Hi, there's a ticket with a patch about the order_by-Problem: http://code.djangoproject.com/ticket/2210. Does it help? Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company

Re: order_by not working with foreign keys:

2007-01-25 Thread Bram - Smartelectronix
Waylan Limberg wrote: > Actually, as you have `related_name` set (to 'stats'), I believe this > may be what you want: > > Book.objects.all().select_related().order_by('-stats__avg_rating')[0:10] OK, as this failed as well, I made a clean example, from ZERO, and tried it. Any ideas why this

Re: order_by not working with foreign keys:

2007-01-24 Thread Waylan Limberg
On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > > Waylan Limberg wrote: > > On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > >> Book.objects.all().select_related() > >> .order_by('-bookshop_bookstat.avg_rating')[0:10] > >> > > > > You should replace

Re: order_by not working with foreign keys:

2007-01-24 Thread Bram - Smartelectronix
Waylan Limberg wrote: > On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: >> Book.objects.all().select_related() >> .order_by('-bookshop_bookstat.avg_rating')[0:10] >> > > You should replace the dot (.) with a double underscore (__), so: > >

Re: order_by not working with foreign keys:

2007-01-24 Thread Waylan Limberg
On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > > Book.objects.all().select_related() > .order_by('-bookshop_bookstat.avg_rating')[0:10] > You should replace the dot (.) with a double underscore (__), so:

Re: order_by not working with foreign keys:

2007-01-24 Thread Bram - Smartelectronix
Honza Král wrote: >> - >> class Book(models.Model): >> >> >> class BookStat(models.Model): >> book = models.OneToOneField(Song, related_name='stats') >> avg_rating = models.FloatField(max_digits=2,

Re: order_by not working with foreign keys:

2007-01-24 Thread Honza Král
On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > > Honza Kr�l wrote: > > it occured before on the mailing list... > > > > if you add select_related(), it will work... > > > > the problem is that specifying ordering like this doesn't force the > > join in the query so you might end

Re: order_by not working with foreign keys:

2007-01-24 Thread Bram - Smartelectronix
Honza Král wrote: > it occured before on the mailing list... > > if you add select_related(), it will work... > > the problem is that specifying ordering like this doesn't force the > join in the query so you might end up with a query that sorts on > something that just isn't there... That

Re: order_by not working with foreign keys:

2007-01-23 Thread Honza Král
it occured before on the mailing list... if you add select_related(), it will work... the problem is that specifying ordering like this doesn't force the join in the query so you might end up with a query that sorts on something that just isn't there... On 1/23/07, Bram - Smartelectronix

order_by not working with foreign keys:

2007-01-23 Thread Bram - Smartelectronix
Hello Everyone, Trying this: Book.objects.all().order_by('-app_statistics.avg_rating') I get: ProgrammingError at /bleep/ ERROR: missing FROM-clause entry for table "app_statistics" at character 375 Anyone know what the problem is? (working with trunk,