Skip to content

Instantly share code, notes, and snippets.

@ZuluPro
Created May 31, 2018 23:47
Show Gist options
  • Save ZuluPro/9bbd3537045b26291fdc046790ab85b4 to your computer and use it in GitHub Desktop.
Save ZuluPro/9bbd3537045b26291fdc046790ab85b4 to your computer and use it in GitHub Desktop.
Django User model Factory
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