spacepaste

  1.  
  2. temp_list = CategoryItem.objects.filter(category__in=categories_list).order_by('category')
  3. big_list = [ 0 for x in range(len(categories_list))]
  4. for x in range(len(temp_list)):
  5. for y in range(len(categories_list)):
  6. if str(temp_list[x].category) == str(categories_list[y].name): tempIndex = y
  7. else: tempIndex = -1
  8. if tempIndex > -1: big_list[tempIndex] = big_list[tempIndex] + 1
  9. counter = 0
  10. category_dict = {}
  11. for category in categories_list:
  12. category_dict[category.name] = big_list[counter]
  13. print category_dict[category.name]
  14. counter = counter + 1
  15.