This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import izip | |
def chunkify(iterable, chunk_size): | |
r""" | |
>>> chunkify(range(1, 11), 2) | |
[(1, 2), (3, 4), (5, 6), (7, 8), (9, 10)] | |
""" | |
_iterable = iter(iterable) | |
return izip(*[_iterable] * chunk_size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple way to see which version of django apps you have | |
# Author: Alexander Artemenko | |
import pkg_resources | |
from django.conf import settings | |
def get_version(app): | |
try: | |
d = pkg_resources.get_distribution(app) | |
return d.project_name, d.version |