""" Presentation of Transaction Types data ====================================== Presents transaction types model data with specific response format. """ def long_and_short_names(results): """Get proper format of list of long and short names of transaction types. Args: results (generator): transaction type data from model TransactionType. Returns: list: list of transaction types dictionaries. """ return [long_and_short_name(result) for result in results] def long_and_short_name(result): """Get proper format of long and short names of a transaction type. Args: result (dict): single transaction type data. Returns: dict: transaction types dictionary. """ return { 'short_name': result.get('transactiontypeabbr'), 'long_name': result.get('transactiontypedesc') }