252697b842
Upgrade site and modules to Django 2.2. Remove and replace obsolete functionality with current equivalents. Update requirements to latest versions where possible. Remove unused dependencies.
65 lines
1.6 KiB
Python
65 lines
1.6 KiB
Python
import datetime
|
|
import random
|
|
|
|
import factory
|
|
|
|
from factory import fuzzy
|
|
|
|
from symposion.schedule.models import Schedule, Day, Slot, SlotKind
|
|
from symposion.conference.models import Section, Conference
|
|
|
|
|
|
class ConferenceFactory(factory.django.DjangoModelFactory):
|
|
title = fuzzy.FuzzyText()
|
|
start_date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1))
|
|
end_date = fuzzy.FuzzyDate(
|
|
datetime.date(2014, 1, 1) + datetime.timedelta(days=random.randint(1, 10))
|
|
)
|
|
# timezone = TimeZoneField("UTC")
|
|
|
|
class Meta:
|
|
model = Conference
|
|
|
|
|
|
class SectionFactory(factory.django.DjangoModelFactory):
|
|
conference = factory.SubFactory(ConferenceFactory)
|
|
name = fuzzy.FuzzyText()
|
|
slug = fuzzy.FuzzyText()
|
|
|
|
class Meta:
|
|
model = Section
|
|
|
|
|
|
class ScheduleFactory(factory.django.DjangoModelFactory):
|
|
section = factory.SubFactory(SectionFactory)
|
|
published = True
|
|
hidden = False
|
|
|
|
class Meta:
|
|
model = Schedule
|
|
|
|
|
|
class SlotKindFactory(factory.django.DjangoModelFactory):
|
|
schedule = factory.SubFactory(ScheduleFactory)
|
|
label = fuzzy.FuzzyText()
|
|
|
|
class Meta:
|
|
model = SlotKind
|
|
|
|
|
|
class DayFactory(factory.django.DjangoModelFactory):
|
|
schedule = factory.SubFactory(ScheduleFactory)
|
|
date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1))
|
|
|
|
class Meta:
|
|
model = Day
|
|
|
|
|
|
class SlotFactory(factory.django.DjangoModelFactory):
|
|
day = factory.SubFactory(DayFactory)
|
|
kind = factory.SubFactory(SlotKindFactory)
|
|
start = datetime.time(random.randint(0, 23), random.randint(0, 59))
|
|
end = datetime.time(random.randint(0, 23), random.randint(0, 59))
|
|
|
|
class Meta:
|
|
model = Slot
|