@register.filter
def rangocinco(obj_id, limit):
if (obj_id+5) > limit:
if not (limit-4) == obj_id:
# print((limit-4), obj_id, flush=True)
return range((limit-4), (limit+1))
else:
# print('SI NO', flush=True)
return range((obj_id-2), (obj_id+3))
else:
# print('NO', flush=True)
if (obj_id-4) < 2:
# print('NO SI', flush=True)
return range(obj_id, (obj_id+5))
else:
# print('NO NO', flush=True)
return range((obj_id-4), (obj_id+1))
Fuck