On Wed, May 13, 2009 at 2:56 PM, Alex Rades <alera...@gmail.com> wrote:
>
> Hi,
> in one of my templates I'd like to show the last <n> images taken from
> a queryset. So the equivalent of:
>
> images.all()[:5]
>
> in a template.
> Is there a simple way to do this? Do i need a templatetag?
>

Hi, Alex.

Trye to use `slice` [1] template filter like this:

{% for i in images|slice:":5" %}


[1]: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#slice

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to