__author__ = 'SDE'

from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()


# @register.filter('get_side_art')
@register.simple_tag
def get_side_art(last_el, counter, els_on_page):
    cur_el = last_el - els_on_page + counter
    if els_on_page < 4:
        first_left_el = els_on_page + 1
    else:
        first_left_el = 4
    if (cur_el - first_left_el) % 2:
        return 'even'
    else:
        return 'odd'

# @register.filter()
# def get_numbers_list(from_el, to_el):
#     res = range(from_el, to_el+1)
#     return res
#
#
# def val_type(value):
#     res = type(value)
#     return res.__name__
# register.filter('val_type', val_type)
#
# @register.filter()
# def get_cols_table_data_for_row_when_cols3(value, row):
#     el_count = 3
#     from_el = (row-1) * el_count
#     to_el = row * el_count
#     part = list(value)[from_el:to_el]
#     return part
# # register.filter('val_type', val_type)
#
#
# @register.filter
# @stringfilter
# def correct_for_tables(value):
#     if value in ['None', '0.0']:
#         return '-'
#     return value
