May be another way of doing this? 5 tools @ 9 hours = 45 hours maximum possible utilisation 1 tool = 9 hours maximum possible utilisation
each tool is a list pa = [] (tool1) pb = [] (tool2) etc max = 9 need to know the count of objects loop all the booking objects use the max count as the index test if all booked hours exceeds max if not then list pa is complete else add together object hours to not exceed max and make each list pa, pb etc ending up with pa = [(object, object, object)] pb = [(object, object, object, object)] etc then unpack the tuples in the template with if statements to position as to time and duration Would that work better? What code would achieve it? Appreciate any help here -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fb6786fe-edcf-4f75-b6a4-769a76a59231%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.