<s> from django import template <EOL> register = template . Library ( ) <EOL> @ register . inclusion_tag ( '<STR_LIT>' ) <EOL> def video_list_item ( video ) : <EOL> return { '<STR_LIT>' : video } <EOL> @ register . inclusion_tag ( '<STR_LIT>' ) <EOL> def pagination ( page_obj , paginator , request ) : <EOL> """<STR_LIT>""" <EOL> base_link = '<STR_LIT:&>' . join ( [ "<STR_LIT>" % ( k , v ) for ( k , v ) in request . GET . items ( ) if k != '<STR_LIT>' ] ) <EOL> if paginator . num_pages <= <NUM_LIT:10> : <EOL> show_pages = [ [ x , "<STR_LIT>" % ( base_link , x ) , False ] for x in range ( <NUM_LIT:1> , paginator . num_pages + <NUM_LIT:1> ) ] <EOL> show_pages [ page_obj . number - <NUM_LIT:1> ] [ <NUM_LIT:2> ] = True <EOL> else : <EOL> if page_obj . number <= <NUM_LIT:5> : <EOL> show_pages = [ [ x , "<STR_LIT>" % ( base_link , x ) , False ] for x in range ( <NUM_LIT:1> , page_obj . number + <NUM_LIT:3> ) ] <EOL> last_pages = [ [ x , "<STR_LIT>" % ( base_link , x ) , False ] for x in range ( paginator . num_pages - <NUM_LIT:1> , paginator . num_pages + <NUM_LIT:1> ) ] <EOL> elif page_obj . number >= paginator . num_pages - <NUM_LIT:5> : <EOL> show_pages = [ [ x , "<STR_LIT>" % ( base_link , x ) , False ] for x in range ( page_obj . number - <NUM_LIT:2> , paginator . num_pages + <NUM_LIT:1> ) ] <EOL> first_pages = [ [ x , "<STR_LIT>" % ( base_link , x ) , False ] for x in range ( <NUM_LIT:1> , <NUM_LIT:3> ) ] <EOL> else : <EOL> first_pages = [ [ x , "<STR_LIT>" % ( base_link , x ) , False ] for x in range ( <NUM_LIT:1> , <NUM_LIT:3> ) ] <EOL> last_pages = [ [ x , "<STR_LIT>" % ( base_link , x ) , False ] for x in range ( paginator . num_pages - <NUM_LIT:1> , paginator . num_pages + <NUM_LIT:1> ) ] <EOL> show_pages = [ [ x , "<STR_LIT>" % ( base_link , x ) , False ] for x in range ( page_obj . number - <NUM_LIT:2> , page_obj . number + <NUM_LIT:3> ) ] <EOL> for i in show_pages : <EOL> if i [ <NUM_LIT:0> ] == page_obj . number : <EOL> i [ <NUM_LIT:2> ] = True <EOL> return locals ( ) </s>
