36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
import random
|
|
|
|
import factory
|
|
|
|
from books.factories import ModuleFactory
|
|
from .models import Assignment, StudentSubmission, SubmissionFeedback
|
|
|
|
from core.factories import fake
|
|
|
|
|
|
class AssignmentFactory(factory.django.DjangoModelFactory):
|
|
class Meta:
|
|
model = Assignment
|
|
|
|
title = factory.LazyAttribute(lambda x: fake.sentence(nb_words=random.randint(4, 8)))
|
|
assignment = factory.LazyAttribute(lambda x: fake.sentence(nb_words=random.randint(4, 8)))
|
|
module = factory.SubFactory(ModuleFactory)
|
|
|
|
|
|
class StudentSubmissionFactory(factory.django.DjangoModelFactory):
|
|
class Meta:
|
|
model = StudentSubmission
|
|
|
|
text = factory.LazyAttribute(lambda x: fake.sentence(nb_words=random.randint(4, 8)))
|
|
assignment = factory.SubFactory(AssignmentFactory)
|
|
final = False
|
|
|
|
|
|
class SubmissionFeedbackFactory(factory.django.DjangoModelFactory):
|
|
class Meta:
|
|
model = SubmissionFeedback
|
|
|
|
text = factory.LazyAttribute(lambda x: fake.sentence(nb_words=random.randint(4, 8)))
|
|
student_submission = factory.SubFactory(StudentSubmissionFactory)
|
|
final = False
|