I try to return paginated objects and then scroll through them. Seems pretty simple. Apparently, I missed something. Can you spot the mistake?
View:
def thumbnails(request): page = request.GET.get('page', 1) album = request.GET.get('a', None ) if (album): objects = Album_Photos.objects.filter(id=album) else: objects = None if (objects): paginator = Paginator(objects, 25) try: photos = paginator.page(page) except PageNotAnInteger: photos = paginator.page(1) except EmptyPage: photos = None
Template:
{% if photos %} {% for photo in photos %} <img src="{{photo.original.url}}"> {% endfor %} {%endif%}
Error:
TemplateSyntaxError at /photos/thumbnails/ Caught TypeError while rendering: 'Page' object is not iterable 1 {% if photos %} 2 {% for photo in photos %} 3 <img src="{{photo.original.url}}"> 4 {% endfor %} 5 {%endif%}
source share