def test_employees_grouped(self): groups = get_groups(self.number_in_group) for g in groups: employees = Employee.objects.all()[g.offset:g.limit] if employees: index = g.name.split('-') self.assertEquals(index[0], employees[0].surname[0].upper()) self.assertEquals(index[1], employees[::-1][0].surname[0].upper())
def get_context_data(self, **kwargs): context = super(IndexList, self).get_context_data(**kwargs) context['alphabet_groups'] = get_groups(self.number_groups) return context