This commit is contained in:
2017-12-08 03:01:16 +03:00
parent 28756b9632
commit e8be2da9e2

View File

@ -5,11 +5,11 @@ register = template.Library()
def truncate(paginator, number):
if number < 5:
truncated_paginator = xrange(1, min(paginator+1, number+3))
truncated_paginator = range(1, min(paginator+1, number+3))
elif number > 4 and number < (paginator-3):
truncated_paginator = xrange(number-3, number+3)
truncated_paginator = range(number-3, number+3)
else:
truncated_paginator = xrange(number-3, paginator+1)
truncated_paginator = range(number-3, paginator+1)
return truncated_paginator
register.filter('truncate', truncate)