def generate_balance_code(): code = random_string(BALANCE_CODE_LENGTH) while len(BalanceCode.objects.filter(code=code)) != 0: code = random_string(BALANCE_CODE_LENGTH) return code
def generate_private_key(): private_key = random_string(PRIVATE_KEY_LENGTH) while len(Profile.objects.filter(private_key=private_key)) != 0: private_key = random_string(PRIVATE_KEY_LENGTH) return private_key