Re: getting max(field) with db-api

2008-09-02 Thread John M
i used that for mine and it always worked! Mine was for a list of child records by date, but child.objects.all()[0] always gave me the most recent object. J On Sep 2, 7:23 am, mwebs <[EMAIL PROTECTED]> wrote: > Hello, > > I want to perform a lookup an getting the object with the highest > integ

Re: getting max(field) with db-api

2008-09-02 Thread mwebs
Oh thanks, I think I have overlooked it :-) On 2 Sep., 16:35, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Wiadomość napisana w dniu 2008-09-02, o godz. 16:23, przez mwebs: > > > > > > > Hello, > > > I want to perform a lookup an getting the object with the highest > > integer value. > > The Model l

Re: getting max(field) with db-api

2008-09-02 Thread Jarek Zgoda
Wiadomość napisana w dniu 2008-09-02, o godz. 16:23, przez mwebs: > > Hello, > > I want to perform a lookup an getting the object with the highest > integer value. > The Model looks something like this: > > MyModel: > name = > number = models.PositiveIntegerField() > > class Meta: > o

getting max(field) with db-api

2008-09-02 Thread mwebs
Hello, I want to perform a lookup an getting the object with the highest integer value. The Model looks something like this: MyModel: name = number = models.PositiveIntegerField() class Meta: ordering = [-number] So I figured out this: highest = MyModel.objects.all()[0] Is t