On Friday 26 May 2006 03:31, Jan Claeys wrote:
> > 2. Use an order_by method to set the reverse order and then get the
> > first item, use a minus sign to denote DESC order:
> >
> >Foo.objects.order_by("-column")[0]
> >
> > The second option is FAR superior. The first solution is, IMO,
> > to
Jay Parlar wrote:
> Maybe a note should go into the db_api docs about -1 not working? I
> did look at those docs before sending my original message, and didn't
> see anything about that.
I think it should throw an exception saying that negative indices are
not supported (and even include a hint
Op do, 25-05-2006 te 11:28 -0400, schreef Ian Maurer:
> Django's QuerySet handles slicing through the LIMIT and OFFSET clauses
> of the database. Since the clauses cannot handle python's "negative
> indexing" scheme, you have 2 choices:
[...]
> 2. Use an order_by method to set the reverse order an
On 5/25/06, Ian Maurer <[EMAIL PROTECTED]> wrote:
>
> Django's QuerySet handles slicing through the LIMIT and OFFSET clauses
> of the database. Since the clauses cannot handle python's "negative
> indexing" scheme, you have 2 choices:
>
> 1. Do the actual evaluation, by converting to a list and th
Django's QuerySet handles slicing through the LIMIT and OFFSET clauses
of the database. Since the clauses cannot handle python's "negative
indexing" scheme, you have 2 choices:
1. Do the actual evaluation, by converting to a list and then doing your slice:
list(Foo.objects.all())[-1]
2. Use
5 matches
Mail list logo