Adding inital version of program control center.

This commit is contained in:
Vidir Valberg Gudmundsson 2017-08-22 11:48:51 +02:00
parent 6a413cdd3c
commit 0edcaeb11e
6 changed files with 188 additions and 89 deletions

View File

@ -144,6 +144,9 @@ urlpatterns = [
url(
r'^ics/', ICSView.as_view(), name="ics_view"
),
url(
r'^control/', ProgramControlCenter.as_view(), name="program_control_center"
),
url(
r'^proposals/', include([
url(

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-08-22 08:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('program', '0044_auto_20170801_1527'),
]
operations = [
migrations.AddField(
model_name='event',
name='proposal',
field=models.OneToOneField(blank=True, help_text='The event proposal object this event was created from', null=True, on_delete=django.db.models.deletion.CASCADE, to='program.EventProposal'),
),
]

View File

@ -409,6 +409,13 @@ class Event(CampRelatedModel):
help_text='Do we intend to record video of this event?'
)
proposal = models.OneToOneField(
'program.EventProposal',
null=True,
blank=True,
help_text='The event proposal object this event was created from',
)
class Meta:
ordering = ['title']
unique_together = (('camp', 'slug'), ('camp', 'title'))

View File

@ -0,0 +1,42 @@
{% extends 'program_base.html' %}
{% block content %}
<table class="table">
<thead>
<th>
Title
<th>
Submitter email
<th>
Status
<th>
Instances
<th>
Video recording
{% for proposal in proposals %}
<tr>
<td>
{{ proposal.title }}
<td>
{{ proposal.user.email }}
<td>
{{ proposal.proposal_status }}
<td>
{% for instance in proposal.event.instances.all %}
<li>
<strong>When:</strong> {{ instance.when.lower|date:"l d. b H:i" }} - {{ instance.when.upper|date:"H:i" }}<br />
<strong>Where:</strong> {{ instance.location.name }}
</li>
{% endfor %}
<td>
{{ proposal.event.video_recording }}
{% endfor %}
</table>
{% endblock %}

View File

@ -8,6 +8,7 @@ from django.conf import settings
from django.views.decorators.http import require_safe
from django.http import Http404, HttpResponse
from django.utils.decorators import method_decorator
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib import messages
from django.urls import reverse
@ -305,3 +306,22 @@ class CallForSpeakersView(CampViewMixin, TemplateView):
def get_template_names(self):
return '%s_call_for_speakers.html' % self.camp.slug
################## control center #############################################
class ProgramControlCenter(CampViewMixin, TemplateView):
template_name = "control/index.html"
@method_decorator(staff_member_required)
def dispatch(self, *args, **kwargs):
return super().dispatch(*args, **kwargs)
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(**kwargs)
proposals = models.EventProposal.objects.filter(
camp=self.camp
).select_related('user', 'event')
context['proposals'] = proposals
return context

View File

@ -295,114 +295,120 @@ class Command(BaseCommand):
slug='{}'.format(slugify(name)),
)
name = 'Standard ticket'
ticket1 = Product.objects.create(
name=name,
description='A ticket',
price=1200,
category=tickets,
available_in=(
timezone.datetime(2017, 3, 1, 12, 0, tzinfo=timezone.utc),
timezone.datetime(2017, 8, 20, 12, 0, tzinfo=timezone.utc),
),
slug='{}'.format(slugify(name)),
)
name = 'Hacker ticket'
ticket2 = Product.objects.create(
name=name,
description='Another ticket',
price=1337,
category=tickets,
available_in=(
timezone.datetime(2017, 3, 1, 12, 0, tzinfo=timezone.utc),
timezone.datetime(2017, 8, 20, 12, 0, tzinfo=timezone.utc),
),
slug='{}'.format(slugify(name)),
)
self.output('Creating orders...')
order0 = Order.objects.create(
user=user1,
payment_method='cash',
open=None,
paid=True
)
order0.orderproductrelation_set.create(
product=ticket1,
quantity=1,
)
order0.orderproductrelation_set.create(
product=tent1,
quantity=1,
)
order1 = Order.objects.create(
user=user2,
payment_method='cash'
)
order1.orderproductrelation_set.create(
product=ticket1,
quantity=1,
)
order1.orderproductrelation_set.create(
product=tent2,
quantity=1,
)
order2 = Order.objects.create(
user=user3,
payment_method='cash'
)
order2.orderproductrelation_set.create(
product=ticket2,
quantity=1,
)
order2.orderproductrelation_set.create(
product=ticket1,
quantity=1,
)
order2.orderproductrelation_set.create(
product=tent2,
quantity=1,
)
order3 = Order.objects.create(
user=user4,
payment_method='cash'
)
order3.orderproductrelation_set.create(
product=product0,
quantity=1,
)
order3.orderproductrelation_set.create(
product=ticket2,
quantity=1,
)
order3.orderproductrelation_set.create(
product=tent1,
quantity=1,
)
for camp in [camp2016, camp2017, camp2018]:
year = camp.camp.lower.year
self.output('Creating tickettypes for {}...'.format(year))
TicketType.objects.create(
adult_full_week = TicketType.objects.create(
name='Adult Full Week',
camp=camp
)
TicketType.objects.create(
adult_one_day = TicketType.objects.create(
name='Adult One Day',
camp=camp
)
TicketType.objects.create(
child_full_week = TicketType.objects.create(
name='Child Full Week',
camp=camp
)
TicketType.objects.create(
child_one_day = TicketType.objects.create(
name='Child One Day',
camp=camp
)
name = 'Standard ticket {}'.format(year)
ticket1 = Product.objects.create(
name=name,
description='A ticket',
price=1200,
category=tickets,
available_in=(
timezone.datetime(2017, 3, 1, 12, 0, tzinfo=timezone.utc),
timezone.datetime(2017, 8, 20, 12, 0, tzinfo=timezone.utc),
),
slug='{}'.format(slugify(name)),
ticket_type=adult_full_week
)
name = 'Hacker ticket {}'.format(year)
ticket2 = Product.objects.create(
name=name,
description='Another ticket',
price=1337,
category=tickets,
available_in=(
timezone.datetime(2017, 3, 1, 12, 0, tzinfo=timezone.utc),
timezone.datetime(2017, 8, 20, 12, 0, tzinfo=timezone.utc),
),
slug='{}'.format(slugify(name)),
ticket_type=adult_full_week
)
self.output('Creating orders...')
order0 = Order.objects.create(
user=user1,
payment_method='cash',
open=None,
paid=True
)
order0.orderproductrelation_set.create(
product=ticket1,
quantity=1,
)
order0.orderproductrelation_set.create(
product=tent1,
quantity=1,
)
order1 = Order.objects.create(
user=user2,
payment_method='cash',
open=None,
)
order1.orderproductrelation_set.create(
product=ticket1,
quantity=1,
)
order1.orderproductrelation_set.create(
product=tent2,
quantity=1,
)
order2 = Order.objects.create(
user=user3,
payment_method='cash',
open=None,
)
order2.orderproductrelation_set.create(
product=ticket2,
quantity=1,
)
order2.orderproductrelation_set.create(
product=ticket1,
quantity=1,
)
order2.orderproductrelation_set.create(
product=tent2,
quantity=1,
)
order3 = Order.objects.create(
user=user4,
payment_method='cash',
open=None,
)
order3.orderproductrelation_set.create(
product=product0,
quantity=1,
)
order3.orderproductrelation_set.create(
product=ticket2,
quantity=1,
)
order3.orderproductrelation_set.create(
product=tent1,
quantity=1,
)
self.output('Creating eventlocations for {}...'.format(year))
speakers_tent = EventLocation.objects.create(