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',
|
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):
|
||||||
|
|
|
@ -2,26 +2,43 @@
|
||||||
|
|
||||||
{% 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">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Speakers</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
{% for event in event_list %}
|
{% for event in event_list %}
|
||||||
{% if event.event_type.name != "Facilities" %}
|
{% if event.event_type.include_in_event_list %}
|
||||||
<a href="{% url 'event_detail' camp_slug=camp.slug slug=event.slug %}" class="list-group-item">
|
<tr>
|
||||||
<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;">
|
<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 }}
|
{{ event.event_type.name }}
|
||||||
</small>
|
|
||||||
{{ event.title }}
|
|
||||||
{% if event.speakers.exists %}
|
|
||||||
by {{ event.speakers.all|join:", " }}
|
|
||||||
{% endif %}
|
|
||||||
</a>
|
</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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</tbody>
|
||||||
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h2>Events for {{ camp.title }} coming soon!</h2>
|
<h2>Events for {{ camp.title }} coming soon!</h2>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue