"""
ex:
  authors_by_letter = fetch_objects_by_letter(Author, 'name')

returns:
  {u'A': [<Author: Ayn Rand>], u'J': [<Author: Jessica Simpson>], u'L': [<Author: Lord Voldemort>], u'T': [<Author: Trey Parker>]}

"""
def fetch_objects_by_letter(model, attr):
	qs = model.objects.all().order_by(attr)
	
	objs_by_letter = dict()
	for obj in qs:
		try:
			tmp = objs_by_letter[obj.__dict__[attr][0]]
		except KeyError:
			objs_by_letter[obj.__dict__[attr][0]] = list()
			
		objs_by_letter[obj.__dict__[attr][0]].append(obj)
		
	return objs_by_letter