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()
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' )
from BankData.models import Account, User from faker import Faker import random fake = Faker() fk = [i for i in range(20)] for i in range(100): b = int(fake.random_int()) c = fake.date() e = random.choice(fk) A = Account(Amount=b, Creating_Date=c, number_id=e) A.save()
from BankData.models import Account, User from faker import Faker import random fake = Faker() A = Account() for i in range(100): A.Amount = int(fake.random_int()) A.Creating_Date = fake.date() A.number_id = 2 A.save()
# 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 while count < 100: A.Amount = int(fake.random_int()) A.Creating_Date = fake.date() A.number_id = 2 A.save() count += 1 ''' '''