...
 
Commits (2)
......@@ -28,7 +28,7 @@ class ProjectParticipantInline(nested_admin.NestedTabularInline):
model = ProjectParticipant
min_num = 0
extra = 0
fields = ('position', 'participant', 'role_nl', 'role_en')
fields = ('position', 'label', 'participant', 'role_nl', 'role_en')
sortable_field_name = 'position'
......@@ -103,7 +103,7 @@ class EventInline(nested_admin.NestedStackedInline):
# prepopulated_fields = {'slug': ('venue', 'project', 'start')}
fieldsets = (
(None, {
'fields': (('published', 'continuous'), ('event_type', 'venue'), (('start'), ('end')))
'fields': (('published', 'continuous'), ('event_type', 'venue', 'show_hours'), (('start'), ('end')))
}),
('Tickets', {
'classes': ('collapse',),
......
# Generated by Django 2.1.1 on 2019-04-08 10:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contour', '0051_auto_20190405_0724'),
]
operations = [
migrations.AlterField(
model_name='event',
name='start',
field=models.DateTimeField(blank=True, null=True),
),
]
# Generated by Django 2.1.1 on 2019-04-08 10:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contour', '0052_auto_20190408_1010'),
]
operations = [
migrations.AddField(
model_name='event',
name='show_hours',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='projectparticipant',
name='label',
field=models.CharField(choices=[('with', 'with'), ('by', 'by')], default='with', max_length=10),
),
]
......@@ -152,17 +152,22 @@ class Event(models.Model):
published = models.BooleanField(default=True)
continuous = models.BooleanField(default=False)
show_hours = models.BooleanField(default=True)
project = models.ForeignKey(Project, on_delete=models.CASCADE)
event_type = models.ForeignKey(EventType, on_delete=models.SET_NULL, null=True)
venue = models.ForeignKey(Venue, on_delete=models.SET_NULL, null=True)
notes_nl = models.TextField(null=True, blank=True)
notes_en = models.TextField(verbose_name="Notes (English)", null=True, blank=True)
start = models.DateTimeField()
start = models.DateTimeField(null=True, blank=True)
end = models.DateTimeField(null=True, blank=True)
show_ticket_link = models.BooleanField(default=True, verbose_name="Tickets sale open")
ticket_link = models.URLField(null=True, blank=True, verbose_name="Ticket link")
sold_out = models.BooleanField(default=False, verbose_name="Event is sold out")
@property
def multiday (self):
return (self.end and self.start.date() != self.end.date())
@property
def grid_coord (self):
return self.__grid_coord
......@@ -216,8 +221,13 @@ class ProjectParticipant(models.Model):
def __str__ (self):
return self.participant.__str__()
LABEL_CHOICES = (
('with', 'with'),
('by', 'by'))
participant = models.ForeignKey(Participant, on_delete=models.CASCADE)
project = SortableForeignKey(Project, on_delete=models.CASCADE)
label = models.CharField(max_length=10, choices=LABEL_CHOICES, default=LABEL_CHOICES[0][0])
role_nl = models.CharField(max_length=255)
role_en = models.CharField(max_length=255, verbose_name="Role (English)")
position = models.PositiveIntegerField(default=0, editable=True, db_index=True)
......
......@@ -408,21 +408,40 @@ main {
font-family: 'Syne';
font-weight: 900;
}
.event .date {
font-family: 'Syne';
font-weight: 900;
text-transform: initial;
}
.date + .hour {
/* .date + .hour {
padding-left: 9px;
} */
.event-data--event {
display: inline;
}
.loop-days .hour::before, .loop-continuous .date::before {
.event-data.event-data--event {
display: inline-block;
}
.event-data--event > :first-child::before {
content: url("/static/contour/images/small-loop.png");
vertical-align: text-top;
padding-right: 2px;
}
.daterange__end {
display: inline-block;
}
.daterange__end::before {
vertical-align: bottom;
padding-right: 2px;
content: url("/static/contour/images/arrow-smaller.png");
}
.venue, .contributor, .hour {
font-family: 'Lack';
}
......@@ -618,7 +637,6 @@ p, h4 {
max-width: 300px;
}
.loop[data-loop-length="1"] {
flex: 3 0 300px;
max-width: 23vw;
......@@ -695,6 +713,10 @@ p, h4 {
margin-right: 200px;
}
.loop-description-inline {
display: none;
}
.continuous {
display: block;
border: 2px solid black;
......@@ -726,11 +748,6 @@ p, h4 {
line-height: 1.75;
}
.continuous-event .event-data::before {
content: url("/static/contour/images/small-loop.png");
vertical-align: text-top;
display: inline-block;
}
.continuous-event .event-data {
margin: 0;
}
......@@ -840,13 +857,13 @@ p, h4 {
background: none;
}
.loop-wrapper[data-loop="1"] .loop {
background: linear-gradient(to bottom, var(--blue-moon-transparent), var(--blue-moon-alpha));
background: linear-gradient(to bottom, var(--blue-moon-transparent), var(--blue-moon-alpha) 125vh);
}
.loop-wrapper[data-loop="2"] .loop {
background: linear-gradient(to bottom, var(--goldy-transparent), var(--goldy-alpha));
background: linear-gradient(to bottom, var(--goldy-transparent), var(--goldy-alpha) 125vh);
}
.loop-wrapper[data-loop="3"] .loop {
background: linear-gradient(to bottom, var(--green-moon-transparent), var(--green-moon-alpha));
background: linear-gradient(to bottom, var(--green-moon-transparent), var(--green-moon-alpha) 125vh);
}
.continuous-title {
......@@ -874,13 +891,25 @@ p, h4 {
position: -webkit-sticky;
position: sticky;
top: 0;
background: linear-gradient(to bottom, white 15%, rgba(255,255,255,0) 95%);
padding: .5em .5em 2em 0;
background: linear-gradient(to bottom, white 40%, rgba(255,255,255,0) 95%);
padding: .5em .5em 1.5em 0;
text-align: right;
margin: 0 0 -5em 0;
margin: 0;
z-index: 2;
}
.loop-title {
padding-bottom: 2.5em;
}
.loop-description-inline {
font-family: 'Latin Modern', serif;
font-size: 1.1em;
line-height: 1.15em;
margin: 0 .5em 1.15em .5em;
display: block;
}
.interbellum .day-date--inline {
text-align: left;
margin-bottom: -1em;
......@@ -893,6 +922,11 @@ p, h4 {
display: block;
border: none;
max-width: initial;
border-top: 2px solid black;
}
.loop .day {
padding-top: 0;
}
.loop-day-date {
......@@ -914,7 +948,7 @@ p, h4 {
display: none;
}
.loop .day .event {
margin-bottom: 3em;
margin-bottom: 2em;
}
#timeline {
display: none;
......@@ -945,23 +979,35 @@ p, h4 {
}
.loop-days .continuous-inline .event {
margin: 0;
margin: 1em 0 0 0;
}
.loop-days .continuous-inline .hour {
font-family: 'Syne';
font-weight: 900;
margin: 1em .5em 0 .5em;
display: inline-block;
margin: -1.75em .5em 1em .5em;
display: block;
text-align: right;
position: -webkit-sticky;
position: sticky;
top: 2em;
z-index: 2;
}
.loop-days .continuous-inline .hour::before {
content: "";
.loop-days .continuous-inline .hour::before {
content: "";
}
.continuous-inline .event .event-data {
margin-left: 0;
margin-right: 0;
}
.continuous-inline {
margin-bottom: 3em;
.loop-days .continuous-inline {
padding-bottom: 1em;
margin-bottom: 1em;
margin: 0 .5em 1em .5em;
border-bottom: 2px solid black;
}
}
......@@ -971,8 +1017,8 @@ p, h4 {
}
.loop-title {
margin-bottom: -3.5em;
background: linear-gradient(to bottom, white 20%, rgba(255,255,255,0) 95%);
background: linear-gradient(to bottom, rgba(255,255,255,.95) 50%, rgba(255,255,255,.7) 70%, rgba(255,255,255,0) 100%);
/* background: white; */
}
.loop-day-date, .loop-title, .day-date {
......
......@@ -61,7 +61,9 @@
<section class="header">
<div class="show-infos">
<time class="date" datetime="{{ event.start|date:'c' }}">{{ event.start|date:"j M" }}{% if event.end and event.end.date != event.start.date %} - {{ event.end|date:"j M" }}{% endif %}</time>
{% if event.show_hours %}
<span class="hour">{{ event.start|date:"H:i" }}{% if event.end %} - {{ event.end|date:"H:i" }}{% endif %}</span>
{% endif }
<span class="type">{{ event.event_type }} </span>
<span class="venue">{% trans "at" %} <a href="{% url 'contour:venue' event.venue.pk %}">{{ event.venue }}</a></span>
<h4 class="title"><a href="{% url 'contour:event' event.pk %}">{{ event.project.title }}</a></h4>
......
{% load static contour thumbnail i18n %}
{% for day in interbellum.days %}
<section class="interbellum" data-label="{{ day.date|date:'D j M' }}" data-type="interbellum" data-t="{{ interbellum.t|stringformat:'0.2f' }}" data-date="{{ day.date|date:"c" }}">
<section class="interbellum" data-label="{{ day.date|date:'D j M' }}{% if day.multiday %} - {{ day.end_date|date:"D j M" }}{% endif %}" data-type="interbellum" data-t="{{ interbellum.t|stringformat:'0.2f' }}" data-date="{{ day.date|date:"c" }}">
<div class="overlay"></div>
<section class="interbellum-spacer-before"></section>
<section class="day" data-main>
<h3 class="loop-title"></h3>
<h3 class="day-date day-date--inline">{{ day.date|date:"D j M" }}</h3>
{% for event in day.events %}
<article class="event" data-pk="{{ event.pk }}" style="">
{% if event.project|cover_image %}
{% with event.project|cover_image as image %}
<figure class="preview">
<a href="{% url 'contour:event' event.pk %}">
<img src="{% thumbnail image.image 500x250 crop upscale subject_location=image.image.subject_location %}">
</a>
</figure>
{% endwith %}
{% endif %}
<section class="event-data">
<time class="hour" datetime="{{ event.start|date:'c' }}">{{ event.start|date:"H:i" }}{% if event.end %} - {{ event.end|date:"H:i" }}{% endif %}</time>
<span class="type">{{ event.event_type }} </span>
<span class="venue">{% trans "at" %}&nbsp;{% if event.venue.published %}<a href="{% url 'contour:venue' event.venue.pk %}">{{ event.venue }}</a>{% else %}{{ event.venue }}{% endif %}</span>
<h4 class="title"><a href="{% url 'contour:event' event.pk %}">{{ event.project.title }}</a></h4>
{% for participant in event.project|sorted_participants|slice:":5" %}
{% if forloop.first %}{% trans "with" %}:&nbsp;{% endif %}<span class="contributor">{% if participant.published %}<a href="{% url 'contour:contributor' participant.pk %}">{{ participant.name }}</a>{% else %}{{ participant.name }}{% endif %}</span>
{% endfor %}
</section>
</article>
<h3 class="day-date day-date--inline">{{ day.date|date:"D j M" }}{% if day.multiday %} <span class="daterange__end">{{ day.end_date|date:"D j M" }}</span>{% endif %}</h3>
{% for entry in day.entries %}
<article class="event" data-pk="{{ event.pk }}">
{% if entry.project|cover_image %}
{% with entry.project|cover_image as image %}
<figure class="preview">
{% with entry.events|first as event %}
<a href="{% url 'contour:event' event.pk %}">
<picture>
<source srcset="{% thumbnail image.image 600x170 crop upscale subject_location=image.image.subject_location %}"
media="(max-width: 600px)">
<img src="{% thumbnail image.image 400x250 crop upscale subject_location=image.image.subject_location %}" />
</picture>
</a>
{% endwith %}
</figure>
{% endwith %}
{% endif %}
<section class="event-data">
{% for event in entry.events %}
{% if forloop.first %}
<h4 class="title"><a href="{% url 'contour:event' event.pk %}">{{ event.project.title }}</a></h4>
{% for participant in event.project|sorted_participants|slice:":5" %}
{% if forloop.first %}{% trans "with" %}:&nbsp;{% endif %}
<span class="contributor">{% if participant.published %}<a href="{% url 'contour:contributor' participant.pk %}">{{ participant.name }}</a>{% else %}{{ participant.name }}{% endif %}</span>
{% endfor %}
{% endif %}
<section class="event-data--event">
{% if day.multiday %}
<time class="date" datetime="{{ event.start|date:'c' }}">{{ event.start|date:"j M" }}{% if event.end %} - {{ event.end|date:"j M" }}{% endif %}</time>
{% endif %}
{% if event.show_hours %}
<time class="hour" datetime="{{ event.start|date:'c' }}">{{ event.start|date:"H:i" }}{% if event.end %} - {{ event.end|date:"H:i" }}{% endif %}</time>
{% endif %}
<span class="type">{{ event.event_type }} </span>
<span class="venue">{% trans "at" %}&nbsp;{% if event.venue.published %}<a href="{% url 'contour:venue' event.venue.pk %}">{{ event.venue }}</a>{% else %}{{ event.venue }}{% endif %}</span>
</section>
{% endfor %}
</section>
</article>
{% endfor %}
</section>
<section class="interbellum-spacer-after"></section>
<section class="interbellum-spacer-after">
</section>
</section>
{% endfor %}
\ No newline at end of file
......@@ -9,6 +9,12 @@
<h3 class="loop-day-date">{{ day.date|date:"D j M" }}</h3>
{% endfor %}
</section>
{% if loop.page %}
<section class="loop-description-inline">
{{ loop.page.summary|markdown }}
<br /><br /><a href="{% url 'contour:page' loop.page.slug %}">{% trans "Show full description" %} →</a><br />
</section>
{% endif %}
<section class="loop-days">
{% if loop.continuous %}
<h3 class="continuous-title">Continuous</h3>
......@@ -28,7 +34,7 @@
{% endif %}
{% for event in loop.continuous %}
<article class="event continuous-event" data-pk="{{ event.pk }}">
<section class="event-data">
<section class="event-data event-data--event">
<h4 class="title"><a href="{% url 'contour:event' event.pk %}">{{ event.project.title }}</a></h4>
<span class="type">{{ event.event_type }} </span>
<span class="venue">{% trans "at" %}&nbsp;{% if event.venue.published %}<a href="{% url 'contour:venue' event.venue.pk %}">{{ event.venue }}</a>{% else %}{{ event.venue }}{% endif %}</span>
......@@ -46,14 +52,22 @@
<h3 class="loop-day-date loop-day-date--inline">{{ day.date|date:"D j M" }}</h3>
{% if loop.continuous %}
<section class="continuous-inline">
{% if forloop.parent.counter <= 2 %}
<time class="hour">10:00 - 20:00:</time>
{% if loop.index == 1 %}
{% if forloop.parent.counter <= 2 %}
<time class="hour">10:00 - 20:00</time>
{% else %}
<time class="hour">12:00 - 17:00</time>
{% endif %}
{% else %}
<time class="hour">12:00 - 17:00:</time>
{% if forloop.parent.counter <= 2 %}
<time class="hour">16:00 - 21:00</time>
{% else %}
<time class="hour">10:00 - 21:00</time>
{% endif %}
{% endif %}
{% for event in loop.continuous %}
<article class="event continuous-event" data-pk="{{ event.pk }}">
<section class="event-data">
<section class="event-data event-data--event">
<h4 class="title"><a href="{% url 'contour:event' event.pk %}">{{ event.project.title }}</a></h4>
<span class="type">{{ event.event_type }} </span>
<span class="venue">{% trans "at" %}&nbsp;{% if event.venue.published %}<a href="{% url 'contour:venue' event.venue.pk %}">{{ event.venue }}</a>{% else %}{{ event.venue }}{% endif %}</span>
......@@ -66,27 +80,34 @@
</section>
{% endif %}
{% for event in day.events %}
<article class="event" data-pk="{{ event.pk }}" style="">
{% if event.project|cover_image %}
{% with event.project|cover_image as image %}
<figure class="preview">
<a href="{% url 'contour:event' event.pk %}">
<img src="{% thumbnail image.image 500x250 crop upscale subject_location=image.image.subject_location %}">
</a>
</figure>
{% endwith %}
{% endif %}
<section class="event-data">
<time class="hour" datetime="{{ event.start|date:'c' }}">{{ event.start|date:"H:i" }}{% if event.end %} - {{ event.end|date:"H:i" }}{% endif %}</time>
<span class="type">{{ event.event_type }} </span>
<span class="venue">{% trans "at" %}&nbsp;{% if event.venue.published %}<a href="{% url 'contour:venue' event.venue.pk %}">{{ event.venue }}</a>{% else %}{{ event.venue }}{% endif %}</span>
<h4 class="title"><a href="{% url 'contour:event' event.pk %}">{{ event.project.title }}</a></h4>
{% for participant in event.project|sorted_participants|slice:":5" %}
{% if forloop.first %}{% trans "with" %}:&nbsp;{% endif %}<span class="contributor">{% if participant.published %}<a href="{% url 'contour:contributor' participant.pk %}">{{ participant.name }}</a>{% else %}{{ participant.name }}{% endif %}</span>
{% endfor %}
</section>
</article>
{% for entry in day.entries %}
{% for event in entry.events %}
<article class="event" data-pk="{{ event.pk }}" style="">
{% if event.project|cover_image %}
{% with event.project|cover_image as image %}
<figure class="preview">
<a href="{% url 'contour:event' event.pk %}">
<picture>
<source srcset="{% thumbnail image.image 600x170 crop upscale subject_location=image.image.subject_location %}"
media="(max-width: 600px)">
<img src="{% thumbnail image.image 400x250 crop upscale subject_location=image.image.subject_location %}" />
</picture>
<!-- <img src="{% thumbnail image.image 500x250 crop upscale subject_location=image.image.subject_location %}"> -->
</a>
</figure>
{% endwith %}
{% endif %}
<section class="event-data event-data--event">
<time class="hour" datetime="{{ event.start|date:'c' }}">{{ event.start|date:"H:i" }}{% if event.end %} - {{ event.end|date:"H:i" }}{% endif %}</time>
<span class="type">{{ event.event_type }} </span>
<span class="venue">{% trans "at" %}&nbsp;{% if event.venue.published %}<a href="{% url 'contour:venue' event.venue.pk %}">{{ event.venue }}</a>{% else %}{{ event.venue }}{% endif %}</span>
<h4 class="title"><a href="{% url 'contour:event' event.pk %}">{{ event.project.title }}</a></h4>
{% for participant in event.project|sorted_participants|slice:":5" %}
{% if forloop.first %}{% trans "with" %}:&nbsp;{% endif %}<span class="contributor">{% if participant.published %}<a href="{% url 'contour:contributor' participant.pk %}">{{ participant.name }}</a>{% else %}{{ participant.name }}{% endif %}</span>
{% endfor %}
</section>
</article>
{% endfor %}
{% endfor %}
</section>
{% endfor %}
......
......@@ -11,54 +11,78 @@ from ethertoff.settings import DEBUG
Interbellum = namedtuple('Interbellum', ['days', 'continuous', 't'])
TemplateLoop = namedtuple('TemplateLoop', ['days', 'continuous', 'name', 'description', 'interbellum', 'index', 'start', 'end', 'page'])
TemplateLoopDay = namedtuple('TemplateLoopDay', ['date', 'events', 'hasEvents'])
Entry = namedtuple('Entry', ['project', 'events'])
# # Create your views here.
# def home(request):
# if DEBUG:
# loops = Loop.objects.filter()
# else:
# loops = Loop.objects.filter(published=True)
# templateLoops = []
# previousLoopEnd = None
# for loop in loops:
# # day = timedelta(days=1)
# # loopdaycount = (loop.end - loop.start).days + 1
# # loopdays = [loop.start + (day * k) for k in range(loopdaycount)]
# if (previousLoopEnd):
# continuous, days = structureEvents(previousLoopEnd, loop.start)
# print('interbellum', continuous, days)
# interbellum = Interbellum(continuous=continuous, days=days)
# else:
# interbellum = Interbellum(continuous=[], days=[])
# continuous, days = structureEvents(loop.start, loop.end + timedelta(days=1), True)
# templateLoop = TemplateLoop(continuous = continuous, days = days, name = loop.name, description = loop.description, interbellum = interbellum)
# Create your views here.
def home(request):
if DEBUG:
loops = Loop.objects.filter()
else:
loops = Loop.objects.filter(published=True)
# previousLoopEnd = loop.end + timedelta(days=1)
templateLoops = []
previousLoopEnd = None
# templateLoops.append(templateLoop)
for loop in loops:
# day = timedelta(days=1)
# loopdaycount = (loop.end - loop.start).days + 1
# loopdays = [loop.start + (day * k) for k in range(loopdaycount)]
# return render(request, 'contour/home.beta.html', {
# 'loops': templateLoops
# })
if (previousLoopEnd):
continuous, days = structureEvents(previousLoopEnd, loop.start)
print('interbellum', continuous, days)
interbellum = Interbellum(continuous=continuous, days=days)
else:
interbellum = Interbellum(continuous=[], days=[])
def makeTemplateLoopDay(date=None, events=[]):
return {
'date': date,
'entries': events,
'end_date': date, # Mmmm, naming
'multiday': False
}
continuous, days = structureEvents(loop.start, loop.end + timedelta(days=1), True)
templateLoop = TemplateLoop(continuous = continuous, days = days, name = loop.name, description = loop.description, interbellum = interbellum)
def makeEntry(project, event):
return { 'project': project, 'events': [event] }
previousLoopEnd = loop.end + timedelta(days=1)
def findProject(day, project):
for index, entry in enumerate(day['entries']):
if entry['project'] == project:
return index
templateLoops.append(templateLoop)
return None
return render(request, 'contour/home.beta.html', {
'loops': templateLoops
})
def addEvent(day, event):
index = findProject(day, event.project)
if index is None:
day['entries'].append(makeEntry(event.project, event))
else:
day['entries'][index]['events'].append(event)
if event.multiday:
day['end_date'] = max(event.end.date(), day['end_date'])
day['multiday'] = True
def generateDates (start, end):
return [start + timedelta(days=k) for k in range((end - start).days)]
def structureEvents(start = None, end = None, fill = False):
days = [TemplateLoopDay(date=date, events=[], hasEvents=False) for date in generateDates(start, end)] if fill else []
days = [makeTemplateLoopDay(date=date, events=[]) for date in generateDates(start, end)] if fill else []
continuous = []
if start and end:
events = Event.objects.filter(start__gt=start, start__lt=end, published=True, project__published=True).order_by('start', 'end')
elif start:
events = Event.objects.filter(start__gt=start, published=True, project__published=True).order_by('start', 'end')
else:
events = Event.objects.filter(start__lt=end, published=True, project__published=True).order_by('start', 'end')
events = getEvents(start, end)
day = None
for event in events:
......@@ -68,14 +92,14 @@ def structureEvents(start = None, end = None, fill = False):
else:
date = event.start.date()
if not day or day.date != date:
if not day or day['date'] != date:
if not fill and day:
days.append(day)
day = days[(date-start).days] if fill else TemplateLoopDay(date=date, events=[], hasEvents=False)
day = days[(date-start).days] if fill else makeTemplateLoopDay(date=date, events=[])
gridOffset = -1
gridOffset = event.set_grid_coord(gridOffset + 1)
day.events.append(event)
day['events'].append(event)
# day.hasEvents = True
if not fill and day:
......@@ -83,6 +107,61 @@ def structureEvents(start = None, end = None, fill = False):
return (continuous, days)
def getEvents(start=None, end=None):
if start and end:
return Event.objects.filter(start__gt=start, start__lt=end, published=True, project__published=True).order_by('start', 'end')
elif start:
return Event.objects.filter(start__gt=start, published=True, project__published=True).order_by('start', 'end')
elif end:
return Event.objects.filter(start__lt=end, published=True, project__published=True).order_by('start', 'end')
def structureLoopEvents(start=None, end=None):
days = [makeTemplateLoopDay(date=date, events=[]) for date in generateDates(start, end)]
continuous = []
day = None
for event in getEvents(start, end):
# Continuous event, add to list of those
if event.continuous:
continuous.append(event)
else:
date = event.start.date()
if not day or day['date'] != date:
day = days[(date-start).days]
addEvent(day, event)
# day['events'].append(event)
return (continuous, days)
def structureInterbellumEvents(start=None, end=None):
days = []
continuous = []
day = None
for event in getEvents(start, end):
# Continuous event, add to list of those
if event.continuous:
continuous.append(event)
else:
date = event.start.date()
if not day or day['date'] != date:
if day:
days.append(day)
day = makeTemplateLoopDay(date=date, events=[])
addEvent(day, event)
if day:
# Where still working on a day
days.append(day)
return (continuous, days)
# Create your views here.
def home(request):
loops = Loop.objects.filter()
......@@ -92,21 +171,17 @@ def home(request):
previousLoopEnd = None
for index, loop in enumerate(loops):
# day = timedelta(days=1)
# loopdaycount = (loop.end - loop.start).days + 1
# loopdays = [loop.start + (day * k) for k in range(loopdaycount)]
if (previousLoopEnd):
continuous, days = structureEvents(start=previousLoopEnd, end=loop.start)
interbellum = Interbellum(continuous=continuous, days=days, t=index - .5)
continuous, days = structureInterbellumEvents(start=previousLoopEnd, end=loop.start)
else:
continuous, days = structureEvents(end=loop.start)
interbellum = Interbellum(continuous=[], days=[], t=index + .5)
continuous, days = structureInterbellumEvents(end=loop.start)
interbellum = Interbellum(continuous=continuous, days=days, t=max(0, index - .5))
timelineEntries.append(interbellum)
if loop.published:
continuous, days = structureEvents(start=loop.start, end=loop.end + timedelta(days=1), fill=True)
continuous, days = structureLoopEvents(start=loop.start, end=loop.end + timedelta(days=1))
timelineEntries.append(TemplateLoop(continuous = continuous, days = days, name = loop.name, description = loop.description, interbellum = interbellum, index = index, start = loop.start, end = loop.end + timedelta(days=1), page = loop.page))
previousLoopEnd = loop.end + timedelta(days=1)
......