def build_currency(currency_pool=currency_pool): letter = rand_char(currency_pool) currency = models.Currency( name='currency%s' % letter, description=rand_string(200), decimal_places=random.randint(0,3) ) currency.save() currencies.append(currency) return currency
def build_pending_trans(users=users, currencies=currencies): """Build pending transactions. Requires users and currencies to be filled. """ creator, target = random.sample(users, 2) trans_record = models.TransactionRecord( creator_person=creator.person, target_person=target.person, from_receiver=rand_bool(), transaction_time=rand_date(), notes=rand_string(200), currency=random.choice(currencies), value=random.randint(1, 200) ) trans_record.save() return trans_record