@register.simple_tag
def paginator_number(cl, i):
 if (i == DOT):
  return u'... '
 elif (i == cl.page_num):
  return format_html(u'<span class="this-page">{0}</span> ', (i + 1))
 else:
  return format_html(u'<a href="{0}"{1}>{2}</a> ', cl.get_query_string({PAGE_VAR: i}), mark_safe((u' class="end"' if (i == (cl.paginator.num_pages - 1)) else u'')), (i + 1))

@ register . simple_tag def paginator_number ( cl , i ) : if ( i == DOT ) : return u'... ' elif ( i == cl . page_num ) : return format_html ( u'<span class="this-page">{0}</span> ' , ( i + 1 ) ) else : return format_html ( u'<a href="{0}"{1}>{2}</a> ' , cl . get_query_string ( { PAGE_VAR : i } ) , mark_safe ( ( u' class="end"' if ( i == ( cl . paginator . num_pages - 1 ) ) else u'' ) ) , ( i + 1 ) )
generates an individual page index link in a paginated list .