symposion_app/pinaxcon/registrasion/management/commands/dummy_presentations.py

38 lines
1.5 KiB
Python
Raw Normal View History

from django.contrib.auth import get_user_model
2019-10-13 03:53:51 +00:00
from django.core.management.base import BaseCommand
2019-10-13 04:04:04 +00:00
from symposion.conference.models import Section, current_conference
2019-10-13 03:53:51 +00:00
from symposion.speakers.models import Speaker
2019-10-13 04:04:04 +00:00
from symposion.schedule.models import Presentation
from symposion.proposals.models import ProposalKind
from pinaxcon.proposals.models import TalkProposal
2019-10-13 03:53:51 +00:00
User = get_user_model()
2019-10-13 03:53:51 +00:00
class Command(BaseCommand):
help = "Creates a bunch of dummy presentations to play around with."
def handle(self, *args, **options):
conf = current_conference()
section = Section.objects.filter(conference=conf, slug="main").all().first()
2019-11-16 05:35:04 +00:00
user = User.objects.first()
2019-10-13 03:53:51 +00:00
speaker = Speaker.objects.first()
2019-11-16 05:35:04 +00:00
if not speaker:
speaker, _ = Speaker.objects.get_or_create(name="Dummy Speaker",
defaults={"user": user})
2019-10-13 03:53:51 +00:00
talk_kind = ProposalKind.objects.first()
target_audience = TalkProposal.TARGET_USER
for i in range(1000, 1020):
2019-10-13 03:53:51 +00:00
prop, _created = TalkProposal.objects.get_or_create(
pk=i, kind=talk_kind, speaker=speaker, target_audience=target_audience,
title=f"dummy title {i}", abstract=f"dummy abstract {i}")
2019-10-13 03:53:51 +00:00
pres, _created = Presentation.objects.get_or_create(
proposal_base=prop, section=section, speaker=speaker,
title=f"dummy title {i}", abstract=f"dummy abstract {i}")