import random

import factory

from core.factories import fake
from portfolio.models import Project, ProjectEntry
from users.models import User


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
    student = factory.Iterator(User.objects.all())



class ProjectEntryFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = ProjectEntry

    project = factory.SubFactory(ProjectFactory)
