fixup the event list a bit, fixes #90
This commit is contained in:
parent
850de5554f
commit
cbd6457947
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-03-26 11:50
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('program', '0036_auto_20170316_0004'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='eventtype',
|
||||
name='include_in_event_list',
|
||||
field=models.BooleanField(default=True, help_text='Include events of this type in the event list?'),
|
||||
),
|
||||
]
|
|
@ -307,6 +307,11 @@ class EventType(CreatedUpdatedModel):
|
|||
help_text='Check to permit users to submit events of this type',
|
||||
)
|
||||
|
||||
include_in_event_list = models.BooleanField(
|
||||
default=True,
|
||||
help_text='Include events of this type in the event list?',
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
@ -366,8 +371,8 @@ class Event(CampRelatedModel):
|
|||
|
||||
@property
|
||||
def speakers_list(self):
|
||||
if self.speakers.exists():
|
||||
return ", ".join(self.speakers.all().values_list('name', flat=True))
|
||||
if self.speaker_set.exists():
|
||||
return ", ".join(self.speaker_set.all().values_list('name', flat=True))
|
||||
return False
|
||||
|
||||
def get_absolute_url(self):
|
||||
|
|
|
@ -2,27 +2,44 @@
|
|||
|
||||
{% block program_content %}
|
||||
{% if event_list %}
|
||||
<p class="lead">
|
||||
An alphabetical list of all talks, workshops, keynotes and other events
|
||||
at {{ camp.title }}.
|
||||
</p>
|
||||
<p class="lead">
|
||||
An alphabetical list of all talks, workshops, keynotes and other events
|
||||
at {{ camp.title }}. The list does not include facilities like bar opening hours.
|
||||
</p>
|
||||
|
||||
<div class="list-group">
|
||||
{% for event in event_list %}
|
||||
{% if event.event_type.name != "Facilities" %}
|
||||
<a href="{% url 'event_detail' camp_slug=camp.slug slug=event.slug %}" class="list-group-item">
|
||||
<small style="background-color: {{ event.event_type.color }}; border: 0; color: {% if event.event_type.light_text %}white{% else %}black{% endif %}; display: inline-block; padding: 5px;">
|
||||
{{ event.event_type.name }}
|
||||
</small>
|
||||
{{ event.title }}
|
||||
{% if event.speakers.exists %}
|
||||
by {{ event.speakers.all|join:", " }}
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Title</th>
|
||||
<th>Speakers</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for event in event_list %}
|
||||
{% if event.event_type.include_in_event_list %}
|
||||
<tr>
|
||||
<td style="background-color: {{ event.event_type.color }}; ">
|
||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}?type={{ event.event_type.slug }}" style="color: {% if event.event_type.light_text %}white{% else %}black{% endif %};">
|
||||
{{ event.event_type.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'event_detail' camp_slug=camp.slug slug=event.slug %}">{{ event.title }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{% for speaker in event.speaker_set.all %}
|
||||
<a href="{% url 'speaker_detail' camp_slug=camp.slug slug=speaker.slug %}">{{ speaker.name }}</a><br>
|
||||
{% empty %}
|
||||
N/A
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<h2>Events for {{ camp.title }} coming soon!</h2>
|
||||
<h2>Events for {{ camp.title }} coming soon!</h2>
|
||||
{% endif %}
|
||||
{% endblock program_content %}
|
||||
|
|
|
@ -160,7 +160,8 @@ class Command(BaseCommand):
|
|||
name='Facilities',
|
||||
slug='facilities',
|
||||
color='#cccccc',
|
||||
light_text=False
|
||||
light_text=False,
|
||||
include_in_event_list=False,
|
||||
)
|
||||
|
||||
slack = EventType.objects.create(
|
||||
|
|
Loading…
Reference in a new issue