...
 
Commits (2)
This diff is collapsed.
...@@ -9,6 +9,7 @@ urlpatterns = [ ...@@ -9,6 +9,7 @@ urlpatterns = [
path('', views.home, name='home'), path('', views.home, name='home'),
path('programme/', views.home, name='programme'), path('programme/', views.home, name='programme'),
path('home-beta/', views.homeBeta, name='homeBeta'), path('home-beta/', views.homeBeta, name='homeBeta'),
path('home-beta-variant/', views.homeBetaVariant, name='homeBetaVariant'),
path('event/<int:pk>', views.event, name='event'), path('event/<int:pk>', views.event, name='event'),
path('contributor/', views.contributor, name='contributor'), path('contributor/', views.contributor, name='contributor'),
path('contributor/<int:pk>', views.contributor, name='contributor'), path('contributor/<int:pk>', views.contributor, name='contributor'),
......
...@@ -145,6 +145,39 @@ def homeBeta(request): ...@@ -145,6 +145,39 @@ def homeBeta(request):
'loops': templateLoops 'loops': templateLoops
}) })
def homeBetaVariant(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)
previousLoopEnd = loop.end + timedelta(days=1)
templateLoops.append(templateLoop)
return render(request, 'contour/home.beta.variant.html', {
'loops': templateLoops
})
# Create your views here. # Create your views here.
def event(request, pk): def event(request, pk):
event = Event.objects.get(pk=pk, published=True) event = Event.objects.get(pk=pk, published=True)
......