Permalink
Browse files

Dummy content generator for timeslots. Email copy.

  • Loading branch information...
1 parent 3ba8cd5 commit e18789bd6887cfb42d196545e33a34b4fbaa39ce @alfredo alfredo committed Jul 5, 2012
View
27 apps/challenges/management/commands/challenges_dummy_content.py
@@ -12,6 +12,7 @@
get_random_winners,
_random_words,
create_user)
+from timeslot.models import TimeSlot, Release
# Expected constants in the DB
@@ -78,6 +79,11 @@ class Command(BaseCommand):
default=False,
dest='judging',
help='Opens the judging stage in closed Phases'),
+ make_option('--webcast',
+ action='store_true',
+ default=False,
+ dest='webcast',
+ help='Creates and releases tickets for the webcast'),
)
def _update_object(self, phase, **kwargs):
@@ -131,6 +137,7 @@ def handle(self, *args, **options):
judging_group.user_set.add(judge.user)
criteria = JudgingCriterion.objects.all()
if not criteria:
+ print "Creating judging criteria"
questions = ['Awesomeness', 'Inovation', 'Feasibility']
criteria_list = [JudgingCriterion.objects.create(question=q) \
for q in questions]
@@ -141,6 +148,7 @@ def handle(self, *args, **options):
development = Phase.objects.get_development_phase()
if not development:
# We need a development phase
+ print "Creating a Development phase"
challenge = Challenge.objects.get(slug=IGNITE_CHALLENGE_SLUG)
development = Phase.objects.create(name=IGNITE_DEVELOPMENT_NAME,
challenge=challenge, order=2)
@@ -160,6 +168,7 @@ def handle(self, *args, **options):
end_date = now - delta
judging_start_date = end_date
if options['judging']:
+ print "Opening judging on Ideation"
judging_end_date = end_date + delta + delta
else:
judging_end_date = end_date
@@ -168,6 +177,7 @@ def handle(self, *args, **options):
judging_start_date=judging_start_date,
judging_end_date=judging_end_date)
if options['judging']:
+ print "Adding judging criteria to Ideation"
for criterion in criteria_list:
ideation.phasecriterion_set.create(criterion=criterion)
if options['submissions']:
@@ -176,8 +186,6 @@ def handle(self, *args, **options):
if options['winners']:
print "Setting up winners for the Ideation Phase"
get_random_winners(ideation)
- if options['judging']:
- pass
# Development ``Phase``
if options['development']:
print "Opening Development Phase"
@@ -200,4 +208,19 @@ def handle(self, *args, **options):
if options['winners']:
print "Setting up winners for the Development Phase"
get_random_winners(development, phase_round=rounds[0])
+
+ if options['webcast']:
+ try:
+ release = Release.objects.get(phase=ideation)
+ except Release.DoesNotExist:
+ print "Creating a Release for the timeslots"
+ release = Release.objects.create(name='Release Ideation',
+ phase=ideation,
+ is_current=True)
+ timeslot_date = now + relativedelta(days=15)
+ print "Creating Timeslots for the release"
+ for i in range(10):
+ TimeSlot.objects.create(start_date=timeslot_date,
+ end_date=timeslot_date,
+ release=release)
print "Done!"
View
2 bin/reset_db.sh
@@ -2,5 +2,5 @@
python manage.py reset_db --router=default
python manage.py syncdb
python manage.py migrate
-python manage.py challenges_dummy_content --development --submissions --winners --judging
+python manage.py challenges_dummy_content --development --submissions --winners --judging --webcast
View
2 settings_local.py-dist
@@ -85,3 +85,5 @@ HAYSTACK_CONNECTIONS = {
'INDEX_NAME': 'haystack',
},
}
+
+EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
View
2 templates_ignite/timeslot/email/confirmation_body.txt
@@ -1,5 +1,5 @@
Hello,
-You have successfully booked a timeslot
+You have successfully booked a timeslot from {{ timeslot.start_date }} to {{ timeslot.end_date }} for your {{ entry }} submission.
The Mozilla Ignite Team

0 comments on commit e18789b

Please sign in to comment.