hm. I'm trying to do this in a context processor and its not working:
def entry_latest(request):
from app.entries.models import Entries
return {'entry_latest': Entries.objects[:5]}
On Apr 22, 2:35 pm, "Honza Král" <[EMAIL PROTECTED]> wrote:
> just slice it:
> entry_list[:5]
>
> just bear in mind that slicing will actually query the database, so
> you need to do it when working with the data (e.g. not in urls.py when
> providing parameters for generic views)
>
> On 4/22/07, drackett <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > I love the ability to get the latest object in a collection..
>
> > entry_list.latest()
>
> > and was curious if there is a way to get more than 1 object. For
> > example, if I want the last 5 entries of a blog, is there something
> > like
>
> > entry_list.latest(5)
>
> > I know that doesn't work, but is there an easy way to do this?
>
> --
> 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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---