def handle(self, *args, **options): UserProfile.objects.all().delete() Author.objects.all().delete() person = Person('en') for _ in range(COUNT_ELEM): first_name = person.first_name() last_name = person.last_name() login = f'{first_name}.{last_name}' email = person.email() birthday_year = datetime.today().year - person.age(minimum=14, maximum=100) print(f'Created:{login} - {email}') user = { "user_name": login, "first_name": first_name, "last_name": last_name, "gender": person.sex('M', 'F'), "birthday_year": birthday_year, "email": email } author = { "first_name": first_name, "last_name": last_name, "birthday_year": birthday_year, } new_user = UserProfile(**user) new_user.save() new_author = Author(**author) new_author.save() User.objects.all().delete() User.objects.create_superuser('admin', 'admin@localhost', 'admin')
# -*- encoding : utf-8 -*- """ @File : __init__.py.py @Time :2021/3/29 18:46 @Author :kuang congxian @Contact :[email protected] @Description : null """ from mimesis import Person from pprint import pprint person = Person("zh") pprint("{}[age:{}, sex:{}, university:{}]".format(person.name(), person.age(), person.sex(), person.university()))