2014-09-21 01:20:04 +00:00
|
|
|
import datetime
|
|
|
|
import random
|
|
|
|
|
|
|
|
import factory
|
2015-09-14 02:34:40 +00:00
|
|
|
|
2014-09-21 01:20:04 +00:00
|
|
|
from factory import fuzzy
|
|
|
|
|
|
|
|
from symposion.schedule.models import Schedule, Day, Slot, SlotKind
|
|
|
|
from symposion.conference.models import Section, Conference
|
|
|
|
|
|
|
|
|
2020-11-22 12:21:54 +00:00
|
|
|
class ConferenceFactory(factory.django.DjangoModelFactory):
|
2014-09-21 01:20:04 +00:00
|
|
|
title = fuzzy.FuzzyText()
|
|
|
|
start_date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1))
|
2015-09-14 02:34:40 +00:00
|
|
|
end_date = fuzzy.FuzzyDate(
|
|
|
|
datetime.date(2014, 1, 1) + datetime.timedelta(days=random.randint(1, 10))
|
|
|
|
)
|
2014-09-22 02:11:12 +00:00
|
|
|
# timezone = TimeZoneField("UTC")
|
2014-09-21 01:20:04 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Conference
|
|
|
|
|
|
|
|
|
2020-11-22 12:21:54 +00:00
|
|
|
class SectionFactory(factory.django.DjangoModelFactory):
|
2014-09-21 01:20:04 +00:00
|
|
|
conference = factory.SubFactory(ConferenceFactory)
|
|
|
|
name = fuzzy.FuzzyText()
|
|
|
|
slug = fuzzy.FuzzyText()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Section
|
|
|
|
|
|
|
|
|
2020-11-22 12:21:54 +00:00
|
|
|
class ScheduleFactory(factory.django.DjangoModelFactory):
|
2014-09-21 01:20:04 +00:00
|
|
|
section = factory.SubFactory(SectionFactory)
|
|
|
|
published = True
|
|
|
|
hidden = False
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Schedule
|
|
|
|
|
|
|
|
|
2020-11-22 12:21:54 +00:00
|
|
|
class SlotKindFactory(factory.django.DjangoModelFactory):
|
2014-09-21 01:20:04 +00:00
|
|
|
schedule = factory.SubFactory(ScheduleFactory)
|
|
|
|
label = fuzzy.FuzzyText()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = SlotKind
|
|
|
|
|
|
|
|
|
2020-11-22 12:21:54 +00:00
|
|
|
class DayFactory(factory.django.DjangoModelFactory):
|
2014-09-21 01:20:04 +00:00
|
|
|
schedule = factory.SubFactory(ScheduleFactory)
|
|
|
|
date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1))
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Day
|
|
|
|
|
|
|
|
|
2020-11-22 12:21:54 +00:00
|
|
|
class SlotFactory(factory.django.DjangoModelFactory):
|
2014-09-21 01:20:04 +00:00
|
|
|
day = factory.SubFactory(DayFactory)
|
|
|
|
kind = factory.SubFactory(SlotKindFactory)
|
2014-09-22 02:11:12 +00:00
|
|
|
start = datetime.time(random.randint(0, 23), random.randint(0, 59))
|
|
|
|
end = datetime.time(random.randint(0, 23), random.randint(0, 59))
|
2014-09-21 01:20:04 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Slot
|