def last_commented(request,records = '30'): comments = Comment.objects.all().order_by('-date') last_statuses = [] for comment in comments: if not len(last_statuses) < int(records): break try: if not comment.status in last_statuses: last_statuses.append(comment.status) last_statuses[-1].number_of_comments = libstatuses.get_number_of_comments(last_statuses[-1].id) except Status.DoesNotExist: continue return render_to_response ('robot/xhr/statuses.html', {'last_statuses': last_statuses})
def lastrecords(request, records): #records = min(30,int(records)) last_statuses = Status.objects.all().order_by('-date') [:records] for status in last_statuses: status.number_of_comments = libstatuses.get_number_of_comments(status.id) return render_to_response ('robot/xhr/statuses.html', {'last_statuses': last_statuses})