def create_account(self): for i in range(self.number2): account = str(np.NaN) account.amount = str(np.NaN) account.creatingdate = str(np.NaN) account.account = str(np.NaN) account.A_account = User(id=(random.randint(1, self.number1))) account.save()
def Generate_Account(n): for i in range(n): account = Account() account.amount = int(fake.random_int()) account.creatingdate = fake.date() account.account = fake.credit_card_number(card_type=None) account.A_account = User(id=(random.randint(1, n))) account.save()
def create_account(self): for i in range(self.number2): account = Account() account.amount = int(fake.random_int()) account.creatingdate = fake.date() account.account = fake.credit_card_number(card_type=None) account.A_account = User(id=(random.randint(1, self.number1))) account.save()
class UserFactory(object): def __init__(self): self.user = User() # Change(1) def set_fullname(self): self.user.fullname = fake.name() # Change(1) def set_surname(self): self.user.surname = fake.name() # Change(1) def set_address(self): self.user.address = fake.address() # Change(1) def set_age(self): self.user.age = fake.random_int(min=18, max=100) # Change(1) def set_company(self): self.user.company = fake.company() # Change(1) def set_status(self): self.user.status = 'Active' if fake.random_int( min=0, max=1) == 1 else 'Inactive' # Change(1) def set_creatingdate(self): self.user.creatingdate = fake.date() # Change(1) def save(self): self.user.save() method_map = { "1": set_fullname, "2": set_surname, "3": set_address, "4": set_age, "5": set_company, "6": set_status, "7": set_creatingdate, }
def create_account(self): for i in range(self.number2): account = Account() account.amount = int(fake.random_int()) if (n1 == 8 or n2 == 8) else None account.creatingdate = fake.date() if (n1 == 7 or n2 == 7) else None account.account = fake.credit_card_number( card_type=None) if (n1 == 9 or n2 == 9) else None account.A_account = User(id=(random.randint(1, self.number1))) account.save() print( f'\nYou have generated {self.number2} rows for Account tables successfully' )
def create_user(self): for i in range(self.number1): user = User() user.fullname = fake.name() if (n1 == 1 or n2 == 1) else None user.surname = fake.name() if (n1 == 2 or n2 == 2) else None user.address = fake.address() if (n1 == 3 or n2 == 3) else None user.age = fake.random_int( min=18, max=100) if (n1 == 4 or n2 == 4) else None user.company = fake.company() if (n1 == 5 or n2 == 5) else None if n1 == 6 or n2 == 6: status = fake.random_int(min=0, max=1) if status == 1: user.status = 'Active' else: user.status = 'Deactive' else: user.status = None user.creatingdate = fake.date() if (n1 == 7 or n2 == 7) else None user.save() print( f'\nYou have generated {self.number1} rows for User tables successfully' )
def InsertAddress(self): user = User() user.address = fake.address() user.save()
from BankData.models import Account, User from faker import Faker import random fake = Faker() number1 = eval(input("How many Fake data you want for User?")) # number2 = 100 eval(input("How many Fake data you want for Account?")) # fk = [i for i in range(number1)] for i in range(number1): # Step.1 Insert User Data with User's Account Number user = User() user.fullname = fake.name() user.surname = fake.name() user.address = fake.address() user.age = fake.random_int(min=18, max=100) user.company = fake.company() user.status = fake.country() user.creatingdate = fake.date() user.save() # Step.2 Insert Fake data to Account Sheet account = Account() account.amount = int(fake.random_int()) account.creatingdate = fake.date() account.account = fake.credit_card_number(card_type=None) account.save() ''' count = 0
def InsertSurname(self): user = User() user.surname = fake.name() user.save()
def Generate_User(n): for i in range(number1): # Step.1 Insert User Data with User's Account Number user = User() user.fullname = fake.name() user.surname = fake.name() user.address = fake.address() user.age = fake.random_int(min=18, max=100) user.company = fake.company() user.status = fake.country() user.creatingdate = fake.date() user.save()
def InsertCompany(self): for i in range(self.number): user = User() user.company = fake.company() user.save()
def InsertCreating_date(self): for i in range(self.number): user = User() user.creatingdate = fake.date() user.save()
def InsertName(self): for i in range(self.number): user = User() user.fullname = fake.name() user.save()
def InsertAddress(self): for i in range(self.number): user = User() user.address = fake.address() user.save()
def InsertAge(self): user = User() user.age = fake.random_int(min=18, max=100) user.save()
def create_user(self): for i in range(self.number1): user = User() user.fullname = str(np.NaN) user.surname = fake.first_name() user.address = str(np.NaN) user.age = str(np.NaN) user.company = str(np.NaN) user.status = str(np.NaN) user.creatingdate = str(np.NaN) user.save()
from BankData.models import Account, User from faker import Faker import random fake = Faker() # number1 = 10 Number of User # eval(input("How many Fake data you want for User?")) # number2 = 100 eval(input("How many Fake data you want for Account?")) # fk = [i for i in range(number1)] user = User() user.Fullname = fake.name() user.Surname = fake.name() user.Address = fake.address() user.Age = fake.random_int(min=18, max=100) user.Company = fake.company() user.Status = fake.country() user.Creating_Date = fake.date() user.U_account = fake.credit_card_number(card_type=None) user.save() # Step.2 Insert Fake data to Account Sheet account = Account() account.A_Amount = int(fake.random_int()) account.A_Creating_Date = fake.date() account.save()
def InsertCreating_date(self): user = User() user.creatingdate = fake.date() user.save()
def InsertCompany(self): user = User() user.company = fake.company() user.save()
def InsertSurname(self): for i in range(self.number): user = User() user.surname = fake.name() user.save()
def __init__(self): self.user = User() # Change(1)
def InsertAge(self): for i in range(self.number): user = User() user.age = fake.random_int(min=18, max=100) user.save()
def InsertAge(self): user.age = fake.random_int(min=18, max=100) user.save() def InsertCompany(self): user.company = fake.company() user.save() def InsertStatus(self): user.status = 'Active' if fake.random_int(min=0, max=1) == 1 else 'Deactive' user.save() def InsertCreating_date(self): user.creatingdate = fake.date() user.save() for k in Create_user.dic: print(k) amount = eval(input("How many data you want to generate? ")) key1 = input("Which two columns you want to insert: ") x, y, z = key1.split(",") for i in range(amount): user = User() insert = Create_user() insert_1 = getattr(insert, Create_user.dic[x])() insert_2 = getattr(insert, Create_user.dic[y])() insert_3 = getattr(insert, Create_user.dic[y])()
def InsertStatus(self): for i in range(self.number): user = User() user.status = 'Active' if fake.random_int(min=0, max=1) == 1 else 'Deactive' user.save()
def create_user(self): for i in range(self.number1): user = User() user.fullname = fake.name() user.surname = fake.name() user.address = fake.address() user.age = fake.random_int(min=18, max=100) user.company = fake.company() user.status = fake.country() user.creatingdate = fake.date() user.save()
from BankData.models import Account, User from faker import Faker import random fake = Faker() A = Account() U = User() U.FullName = fake.name() U.Surname = fake.name() U.Address = fake.address() U.Age = fake.random_int(min=18, max=100) U.Company = fake.company() U.Status = fake.country() U.Creating_Date = fake.date() U.save()
def InsertName(self): user = User() user.fullname = fake.name() user.save()