<s> from django . template import Library , Variable <EOL> register = Library ( ) <EOL> def get_cycle_details ( object ) : <EOL> return { '<STR_LIT>' : object . cycle , '<STR_LIT:url>' : object . get_absolute_url ( ) } <EOL> @ register . inclusion_tag ( '<STR_LIT>' ) <EOL> def cycle_select_block ( cycled_object_list ) : <EOL> selected_cycle = None <EOL> cycles = [ ] <EOL> selected_cycle_object = None <EOL> if cycled_object_list : <EOL> selected_cycle_object = get_cycle_details ( cycled_object_list [ <NUM_LIT:0> ] ) <EOL> for this_cycled_object in cycled_object_list : <EOL> cycles . append ( get_cycle_details ( this_cycled_object ) ) <EOL> cycles = sorted ( cycles ) <EOL> display = len ( cycles ) > <NUM_LIT:0> <EOL> is_selectable = len ( cycles ) > <NUM_LIT:1> <EOL> print cycles <EOL> return { '<STR_LIT>' : cycles , '<STR_LIT>' : selected_cycle_object , '<STR_LIT>' : display , '<STR_LIT>' : is_selectable } </s>
