Interesting. To support your statement, I tried it myself and here's what I
got from my shell...
In [1]: from aids.trends.models import County

In [2]: foo = County.objects.all()[:3]

In [3]: foo

Out[3]: [<County: Abbeville>, <County: Aiken>, <County: Allendale>]

In [4]: foo.reverse()

Out[4]: [<County: Abbeville>, <County: Aiken>, <County: Allendale>]

In [5]: foo.reverse()

Out[5]: [<County: Abbeville>, <County: Aiken>, <County: Allendale>]

In [6]: foo

Out[6]: [<County: Abbeville>, <County: Aiken>, <County: Allendale>]

In [7]: l = [1,2,3]

In [8]: l

Out[8]: [1, 2, 3]

In [9]: l.reverse()

In [10]: l

Out[10]: [3, 2, 1]

And then I fixed it with:

In [18]: County.objects.order_by('-id')[County.objects.count()-3:]

Out[18]: [<County: Allendale>, <County: Aiken>, <County: Abbeville>]

Not sure how, from a performance prospective, that works... but it does
work.

 -justin

On Fri, May 2, 2008 at 11:11 AM, web-junkie <[EMAIL PROTECTED]> wrote:

>
> That's exactly what I tried, and as I described, it gives you
> something wrong, not the queryset reversed...
>
> On 1 Mai, 19:32, "Justin Lilly" <[EMAIL PROTECTED]> wrote:
> > While it may be the long way around, can you not do the following?
> > a = Articles.objects.all()[:3]
> > a.reverse()
> >
> > That would probably be my solution.
> >
> >   -justin
> >
> >
> >
> >
> >
> > On Thu, May 1, 2008 at 12:36 PM, web-junkie <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> >
> > > what is the new reverse() method good for? Seems it just swaps the
> > > order_by statement?
> > > I would appreciate a reverse() method that, if used after slicing,
> > > would actually reverse the queryset.
> > > In the docs it's said: "Django doesn't support that mode of access
> > > (slicing from the end), because it's not possible to do it efficiently
> > > in SQL."
> > > That is nonsense, because reverse should not slice from anywhere, it
> > > should just reverse, and you can do that in python.
> > > So when I have Articles.objects.all()[:3] which gives me a,b,c,
> > > Articles.objects.all()[:3].reverse() would make c,b,a out of it, not
> > > z,y,x! Or am I missing something?
> >
> > --
> > Justin Lilly
> > Web Developer/Designerhttp://justinlilly.com- Zitierten Text ausblenden
> -
> >
> > - Zitierten Text anzeigen -
> >
>


-- 
Justin Lilly
Web Developer/Designer
http://justinlilly.com

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