Skip to content

Instantly share code, notes, and snippets.

@eeriksp
Last active February 18, 2019 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eeriksp/e1d8b5ebb91d9fc103ce33d63a984ed3 to your computer and use it in GitHub Desktop.
Save eeriksp/e1d8b5ebb91d9fc103ce33d63a984ed3 to your computer and use it in GitHub Desktop.
from factory.django import DjangoModelFactory as ModelFactory
class ProjectFactory(ModelFactory):
class Meta:
model = Project
director = factory.SubFactory(VolunteerFactory) # Creates dependency
warehouse = factory.Sequence(lambda n: f'Project__name-{n}') # Guarantees uniqueness
deadline = factory.LazyFunction(datetime.date.today)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment