from django.shortcuts import render, redirect from django.template import RequestContext from django.conf import settings from rowers.forms import LoginForm from django.http import HttpResponse from rowingdata import main as rmain import random def landingview(request): return render( request, 'landingpage.html', ) def logoview(request): # pragma: no cover image_data = open(settings.STATIC_ROOT+"/img/apple-icon-144x144.png", "rb").read() return HttpResponse(image_data, content_type="image/png") def rootview(request): # pragma: no cover magicsentence = rmain() loginform = LoginForm() planoffering = { 'name': 'PLAN', 'image': '/static/img/Plan.png', 'text': 'We offer a fully integrated way for you or your coach to set up a training plan. Compare plan vs execution based on time, distance, heart rate or power.' } uploadoffering = { 'name': 'SYNC', 'image': '/static/img/upload.png', 'text': 'Easily upload data from the most popular devices and apps' } logoffering = { 'name': 'LOG', 'image': '/static/img/log.png', 'text': 'Maintain a consistent log for all your rowing (indoor and on the water)' } analyzeoffering = { 'name': 'ANALYZE', 'image': '/static/img/analyze.png', 'text': 'Analyze your workouts with a consistent set of tools' } compareoffering = { 'name': 'COMPARE', 'image': '/static/img/compare.png', 'text': 'Compare your results between workouts and with other rowers in your team' } raceoffering = { 'name': 'RACE', 'image': '/static/img/Race 01.png', 'text': 'Virtual regattas are an informal way to add a competitive element to your training and can be used as a quick way to set up small regattas' } coachoffering = { 'name': 'COACHING', 'image': '/static/img/Remote coaching.png', 'text': 'Rowsandall.com is the ideal platform for remote rowing coaching. As a coach, you can easily manage your athletes, set up plans and monitor execution and technique' } allofferings = [ planoffering, uploadoffering, logoffering, analyzeoffering, raceoffering, compareoffering, coachoffering, ] aux = list(allofferings) random.shuffle(aux) offerings = aux[0:5] return render(request, 'frontpage.html', { 'versionstring': magicsentence, 'form': loginform, 'offerings': offerings, })