Adding inital version of program control center.
This commit is contained in:
parent
6a413cdd3c
commit
0edcaeb11e
|
@ -144,6 +144,9 @@ urlpatterns = [
|
||||||
url(
|
url(
|
||||||
r'^ics/', ICSView.as_view(), name="ics_view"
|
r'^ics/', ICSView.as_view(), name="ics_view"
|
||||||
),
|
),
|
||||||
|
url(
|
||||||
|
r'^control/', ProgramControlCenter.as_view(), name="program_control_center"
|
||||||
|
),
|
||||||
url(
|
url(
|
||||||
r'^proposals/', include([
|
r'^proposals/', include([
|
||||||
url(
|
url(
|
||||||
|
|
21
src/program/migrations/0045_event_proposal.py
Normal file
21
src/program/migrations/0045_event_proposal.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -409,6 +409,13 @@ class Event(CampRelatedModel):
|
||||||
help_text='Do we intend to record video of this event?'
|
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:
|
class Meta:
|
||||||
ordering = ['title']
|
ordering = ['title']
|
||||||
unique_together = (('camp', 'slug'), ('camp', 'title'))
|
unique_together = (('camp', 'slug'), ('camp', 'title'))
|
||||||
|
|
42
src/program/templates/control/index.html
Normal file
42
src/program/templates/control/index.html
Normal 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 %}
|
|
@ -8,6 +8,7 @@ from django.conf import settings
|
||||||
from django.views.decorators.http import require_safe
|
from django.views.decorators.http import require_safe
|
||||||
from django.http import Http404, HttpResponse
|
from django.http import Http404, HttpResponse
|
||||||
from django.utils.decorators import method_decorator
|
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.auth.mixins import LoginRequiredMixin
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
@ -305,3 +306,22 @@ class CallForSpeakersView(CampViewMixin, TemplateView):
|
||||||
def get_template_names(self):
|
def get_template_names(self):
|
||||||
return '%s_call_for_speakers.html' % self.camp.slug
|
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
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,30 @@ class Command(BaseCommand):
|
||||||
slug='{}'.format(slugify(name)),
|
slug='{}'.format(slugify(name)),
|
||||||
)
|
)
|
||||||
|
|
||||||
name = 'Standard ticket'
|
|
||||||
|
|
||||||
|
for camp in [camp2016, camp2017, camp2018]:
|
||||||
|
year = camp.camp.lower.year
|
||||||
|
|
||||||
|
self.output('Creating tickettypes for {}...'.format(year))
|
||||||
|
adult_full_week = TicketType.objects.create(
|
||||||
|
name='Adult Full Week',
|
||||||
|
camp=camp
|
||||||
|
)
|
||||||
|
adult_one_day = TicketType.objects.create(
|
||||||
|
name='Adult One Day',
|
||||||
|
camp=camp
|
||||||
|
)
|
||||||
|
child_full_week = TicketType.objects.create(
|
||||||
|
name='Child Full Week',
|
||||||
|
camp=camp
|
||||||
|
)
|
||||||
|
child_one_day = TicketType.objects.create(
|
||||||
|
name='Child One Day',
|
||||||
|
camp=camp
|
||||||
|
)
|
||||||
|
|
||||||
|
name = 'Standard ticket {}'.format(year)
|
||||||
ticket1 = Product.objects.create(
|
ticket1 = Product.objects.create(
|
||||||
name=name,
|
name=name,
|
||||||
description='A ticket',
|
description='A ticket',
|
||||||
|
@ -306,9 +329,10 @@ class Command(BaseCommand):
|
||||||
timezone.datetime(2017, 8, 20, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2017, 8, 20, 12, 0, tzinfo=timezone.utc),
|
||||||
),
|
),
|
||||||
slug='{}'.format(slugify(name)),
|
slug='{}'.format(slugify(name)),
|
||||||
|
ticket_type=adult_full_week
|
||||||
)
|
)
|
||||||
|
|
||||||
name = 'Hacker ticket'
|
name = 'Hacker ticket {}'.format(year)
|
||||||
ticket2 = Product.objects.create(
|
ticket2 = Product.objects.create(
|
||||||
name=name,
|
name=name,
|
||||||
description='Another ticket',
|
description='Another ticket',
|
||||||
|
@ -319,6 +343,7 @@ class Command(BaseCommand):
|
||||||
timezone.datetime(2017, 8, 20, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2017, 8, 20, 12, 0, tzinfo=timezone.utc),
|
||||||
),
|
),
|
||||||
slug='{}'.format(slugify(name)),
|
slug='{}'.format(slugify(name)),
|
||||||
|
ticket_type=adult_full_week
|
||||||
)
|
)
|
||||||
|
|
||||||
self.output('Creating orders...')
|
self.output('Creating orders...')
|
||||||
|
@ -339,7 +364,8 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
order1 = Order.objects.create(
|
order1 = Order.objects.create(
|
||||||
user=user2,
|
user=user2,
|
||||||
payment_method='cash'
|
payment_method='cash',
|
||||||
|
open=None,
|
||||||
)
|
)
|
||||||
order1.orderproductrelation_set.create(
|
order1.orderproductrelation_set.create(
|
||||||
product=ticket1,
|
product=ticket1,
|
||||||
|
@ -351,7 +377,8 @@ class Command(BaseCommand):
|
||||||
)
|
)
|
||||||
order2 = Order.objects.create(
|
order2 = Order.objects.create(
|
||||||
user=user3,
|
user=user3,
|
||||||
payment_method='cash'
|
payment_method='cash',
|
||||||
|
open=None,
|
||||||
)
|
)
|
||||||
order2.orderproductrelation_set.create(
|
order2.orderproductrelation_set.create(
|
||||||
product=ticket2,
|
product=ticket2,
|
||||||
|
@ -367,7 +394,8 @@ class Command(BaseCommand):
|
||||||
)
|
)
|
||||||
order3 = Order.objects.create(
|
order3 = Order.objects.create(
|
||||||
user=user4,
|
user=user4,
|
||||||
payment_method='cash'
|
payment_method='cash',
|
||||||
|
open=None,
|
||||||
)
|
)
|
||||||
order3.orderproductrelation_set.create(
|
order3.orderproductrelation_set.create(
|
||||||
product=product0,
|
product=product0,
|
||||||
|
@ -382,28 +410,6 @@ class Command(BaseCommand):
|
||||||
quantity=1,
|
quantity=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
for camp in [camp2016, camp2017, camp2018]:
|
|
||||||
year = camp.camp.lower.year
|
|
||||||
|
|
||||||
self.output('Creating tickettypes for {}...'.format(year))
|
|
||||||
TicketType.objects.create(
|
|
||||||
name='Adult Full Week',
|
|
||||||
camp=camp
|
|
||||||
)
|
|
||||||
TicketType.objects.create(
|
|
||||||
name='Adult One Day',
|
|
||||||
camp=camp
|
|
||||||
)
|
|
||||||
TicketType.objects.create(
|
|
||||||
name='Child Full Week',
|
|
||||||
camp=camp
|
|
||||||
)
|
|
||||||
TicketType.objects.create(
|
|
||||||
name='Child One Day',
|
|
||||||
camp=camp
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
self.output('Creating eventlocations for {}...'.format(year))
|
self.output('Creating eventlocations for {}...'.format(year))
|
||||||
speakers_tent = EventLocation.objects.create(
|
speakers_tent = EventLocation.objects.create(
|
||||||
name='Speakers Tent',
|
name='Speakers Tent',
|
||||||
|
|
Loading…
Reference in a new issue