Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (23 sloc) 1.03 KB
# -*- coding: utf-8 -*-
# Amara, universalsubtitles.org
#
# Copyright (C) 2012 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see http://www.gnu.org/licenses/agpl-3.0.html.
from itertools import chain
from django.core.paginator import Paginator
def chunkediter(objects, chunk_size=200):
pages = Paginator(objects, chunk_size)
return chain.from_iterable(pages.page(i).object_list
for i in pages.page_range)
Something went wrong with that request. Please try again.