import random import factory from core.factories import fake from portfolio.models import Project, ProjectEntry class ProjectFactory(factory.django.DjangoModelFactory): class Meta: model = Project objectives = factory.LazyAttribute(lambda x: fake.sentence(nb_words=random.randint(4, 8))) title = factory.LazyAttribute(lambda x: fake.sentence(nb_words=random.randint(4, 8))) appearance = factory.LazyAttribute(lambda x: random.choice(['red', 'green', 'yellow'])) final = False