fixup the event list a bit, fixes #90

This commit is contained in:
Thomas Steen Rasmussen 2017-03-26 15:05:29 +02:00
parent 850de5554f
commit cbd6457947
4 changed files with 66 additions and 23 deletions

View file

@ -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?'),
),
]

View file

@ -307,6 +307,11 @@ class EventType(CreatedUpdatedModel):
help_text='Check to permit users to submit events of this type', 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): def __str__(self):
return self.name return self.name
@ -366,8 +371,8 @@ class Event(CampRelatedModel):
@property @property
def speakers_list(self): def speakers_list(self):
if self.speakers.exists(): if self.speaker_set.exists():
return ", ".join(self.speakers.all().values_list('name', flat=True)) return ", ".join(self.speaker_set.all().values_list('name', flat=True))
return False return False
def get_absolute_url(self): def get_absolute_url(self):

View file

@ -2,27 +2,44 @@
{% block program_content %} {% block program_content %}
{% if event_list %} {% if event_list %}
<p class="lead"> <p class="lead">
An alphabetical list of all talks, workshops, keynotes and other events An alphabetical list of all talks, workshops, keynotes and other events
at {{ camp.title }}. at {{ camp.title }}. The list does not include facilities like bar opening hours.
</p> </p>
<div class="list-group"> <table class="table table-bordered table-hover">
{% for event in event_list %} <thead>
{% if event.event_type.name != "Facilities" %} <tr>
<a href="{% url 'event_detail' camp_slug=camp.slug slug=event.slug %}" class="list-group-item"> <th>Type</th>
<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;"> <th>Title</th>
{{ event.event_type.name }} <th>Speakers</th>
</small> </tr>
{{ event.title }} </thead>
{% if event.speakers.exists %} <tbody>
by {{ event.speakers.all|join:", " }} {% for event in event_list %}
{% endif %} {% if event.event_type.include_in_event_list %}
</a> <tr>
{% endif %} <td style="background-color: {{ event.event_type.color }}; ">
{% endfor %} <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 %};">
</div> {{ 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 %} {% else %}
<h2>Events for {{ camp.title }} coming soon!</h2> <h2>Events for {{ camp.title }} coming soon!</h2>
{% endif %} {% endif %}
{% endblock program_content %} {% endblock program_content %}

View file

@ -160,7 +160,8 @@ class Command(BaseCommand):
name='Facilities', name='Facilities',
slug='facilities', slug='facilities',
color='#cccccc', color='#cccccc',
light_text=False light_text=False,
include_in_event_list=False,
) )
slack = EventType.objects.create( slack = EventType.objects.create(