Created
May 31, 2018 23:47
-
-
Save ZuluPro/9bbd3537045b26291fdc046790ab85b4 to your computer and use it in GitHub Desktop.
Django User model Factory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import factory | |
class UserFactory(factory.django.DjangoModelFactory): | |
class Meta: | |
model = 'myapp.User' | |
django_get_or_create = ('username',) | |
username = factory.Faker('user_name') | |
first_name = factory.Faker('first_name') | |
last_name = factory.Faker('last_name') | |
email = factory.Faker('email') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment