nodes: 0, module; 1, function_definition; 2, function_name:get_next_sort_string; 3, parameters; 4, block; 5, identifier:self; 6, identifier:field; 7, expression_statement; 8, comment:# self.sort_field is the currect sort field; 9, if_statement; 10, return_statement; 11, comment:"""
          If we're already sorted by the field then the sort query
          returned reverses the sort order.
          """; 12, comparison_operator:field == self.sort_field; 13, block; 14, else_clause; 15, call; 16, identifier:field; 17, attribute; 18, expression_statement; 19, block; 20, attribute; 21, argument_list; 22, identifier:self; 23, identifier:sort_field; 24, assignment; 25, expression_statement; 26, expression_statement; 27, identifier:self; 28, identifier:get_sort_string; 29, identifier:next_sort; 30, identifier:next_sort; 31, binary_operator:self.toggle_sort_order() + field; 32, assignment; 33, assignment; 34, call; 35, identifier:field; 36, identifier:default_order_for_field; 37, line_continuation:\; 38, subscript; 39, identifier:next_sort; 40, binary_operator:default_order_for_field + field; 41, attribute; 42, argument_list; 43, subscript; 44, string; 45, identifier:default_order_for_field; 46, identifier:field; 47, identifier:self; 48, identifier:toggle_sort_order; 49, attribute; 50, identifier:field; 51, string_content:default_direction; 52, identifier:self; 53, identifier:_allowed_sort_fields
code: def get_next_sort_string(self, field):
          """
          If we're already sorted by the field then the sort query
          returned reverses the sort order.
          """
          # self.sort_field is the currect sort field
          if field == self.sort_field:
              next_sort = self.toggle_sort_order() + field
          else:
              default_order_for_field = \
                  self._allowed_sort_fields[field]['default_direction']
              next_sort = default_order_for_field + field
          return self.get_sort_string(next_sort)