diff --git a/rowers/urls.py b/rowers/urls.py index 8fe5c55d..190424dc 100644 --- a/rowers/urls.py +++ b/rowers/urls.py @@ -110,6 +110,7 @@ urlpatterns = [ url(r'^api-docs$', views.schema_view), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^api/workouts/(?P\d+)/strokedata$',views.strokedatajson), + url(r'^500v/$',views.error500_view), url(r'^500/$', TemplateView.as_view(template_name='500.html'),name='500'), url(r'^404/$', TemplateView.as_view(template_name='404.html'),name='404'), url(r'^400/$', TemplateView.as_view(template_name='400.html'),name='400'), diff --git a/rowsandall_app/settings_dev.py b/rowsandall_app/settings_dev.py index 8ebb5caf..d507ce09 100644 --- a/rowsandall_app/settings_dev.py +++ b/rowsandall_app/settings_dev.py @@ -44,9 +44,10 @@ CELERY_SEND_TASK_SENT_EVENT = True # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False +TEMPLATE_DEBUG = DEBUG -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['localhost'] # Application definition diff --git a/rowsandall_app/urls.py b/rowsandall_app/urls.py index 26734641..eea73c39 100644 --- a/rowsandall_app/urls.py +++ b/rowsandall_app/urls.py @@ -21,6 +21,16 @@ from rowsandall_app.views import rootview from django.contrib.auth import views as auth_views from rowers import views as rowersviews +from django.conf.urls import ( + handler400, handler403, handler404, handler500 +) + +handler400 = 'rowers.views.error400_view' +handler403 = 'rowers.views.error403_view' +handler404 = 'rowers.views.error404_view' +handler500 = 'rowers.views.error500_view' + + urlpatterns = [ url(r'^password_change_done/$',auth_views.password_change_done,name='password_change_done'), url(r'^password_change/$',auth_views.password_change), diff --git a/rowsandall_app/views.py b/rowsandall_app/views.py index 921e05f6..4bcc1b91 100644 --- a/rowsandall_app/views.py +++ b/rowsandall_app/views.py @@ -1,4 +1,5 @@ from django.shortcuts import render, redirect, render_to_response +from django.template import RequestContext from django.conf import settings from rowingdata import main as rmain diff --git a/templates/400.html b/templates/400.html new file mode 100644 index 00000000..025dfc60 --- /dev/null +++ b/templates/400.html @@ -0,0 +1,16 @@ +{% extends "basenofilters.html" %} +{% load staticfiles %} +{% load rowerfilters %} + +{% block title %}Change Workout {% endblock %} + +{% block content %} + +
+

Bad Request

+

+HTTP Error 400 Bad Request. +

+
+ +{% endblock %} diff --git a/templates/403.html b/templates/403.html new file mode 100644 index 00000000..3a3d7df7 --- /dev/null +++ b/templates/403.html @@ -0,0 +1,17 @@ +{% extends "basenofilters.html" %} +{% load staticfiles %} +{% load rowerfilters %} + +{% block title %}Change Workout {% endblock %} + +{% block content %} + +
+

Forbidden

+

+ Access forbidden. You probably tried to access functionality on a workout + or chart that is not owned by you. +

+
+ +{% endblock %} diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 00000000..33fd4812 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,15 @@ +{% extends "basenofilters.html" %} +{% load staticfiles %} + +{% block title %}Change Workout {% endblock %} + +{% block content %} + +
+

Error 404 Page not found

+

+We could not find the page on our server. +

+
+ +{% endblock %} diff --git a/templates/500.html b/templates/500.html new file mode 100644 index 00000000..d60793eb --- /dev/null +++ b/templates/500.html @@ -0,0 +1,21 @@ +{% extends "basenofilters.html" %} +{% load staticfiles %} + +{% block title %}Change Workout {% endblock %} + +{% block content %} + +
+

Error 500 Internal Server Error

+

+ The site reported an internal server error. The site developer has been + notified automatically with a full error report. You can help the developer + by reporting an issue on Bitbucket using the button below. +

+ + +
+ +{% endblock %} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 00000000..77fa6213 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,42 @@ +{% extends "basebase.html" %} +{% block filters %} + {% load rowerfilters %} +{% endblock %} + +{% block teams %} + {% if user.is_authenticated and user|has_teams %} + + See recent workouts for your team + {% elif user.is_authenticated and user.rower.team.all %} + + See recent workouts for your team + {% else %} +

 

+ {% endif %} +{% endblock %} + +{% block content %} + +{% endblock %} diff --git a/templates/basebase.html b/templates/basebase.html new file mode 100644 index 00000000..a97bbb60 --- /dev/null +++ b/templates/basebase.html @@ -0,0 +1,219 @@ +{% load cookielaw_tags %} +{% load analytical %} +{% block filters %} +{% endblock %} + + + + + {% analytical_head_top %} + {% if GOOGLE_ANALYTICS_PROPERTY_ID %} + {% include "ga.html" %} + {% endif %} + + + + + + + + + + + Rowsandall + + + + + {% block meta %} {% endblock %} + {% analytical_head_bottom %} + + + {% analytical_body_top %} + {% block body_top %}{% endblock %} +
+
+   +
+
+ +
+
+
+ +
+ +
+ +
+
+

Free Data and Analysis. For Rowers. By Rowers.

+
+
+ +
+
+ {% if user.is_authenticated %} +

+ {{ user.first_name }} +

+ Edit user account, e.g. heart rate zones, power zones, email, teams + + {% else %} +

login

+ {% endif %} +
+
+ {% if user.is_authenticated %} +

logout

+ {% else %} +

 

+ {% endif %} +
+
+
+ {% if user.rower.rowerplan == 'pro' or user.rower.rowerplan == 'coach' %} +
Pro Member
+ {% else %} + + {% endif %} +
+
+
+ + +
+
+ {% if user.is_authenticated %} +

Upload

+ Upload CSV, TCX, FIT data files to rowsandall.com + {% else %} +

Register (free)

+ {% endif %} +
+
+ {% if user.is_authenticated %} +

+ Import +

+ Import workouts from Strava, SportTracks, and C2 logbook + {% else %} +

 

+ {% endif %} +
+
+ {% if user.is_authenticated %} +

+ Workouts +

+ See your list of workouts + {% else %} +

 

+ {% endif %} +
+
+ {% if user.is_authenticated %} +

+ Graphs +

+ See your most recent charts + {% else %} +

 

+ {% endif %} +
+
+ {% if user.is_authenticated %} +

+ Analysis +

+ Analysis of workouts over a period of time + {% else %} +

 

+ {% endif %} +
+
+ {% block teams %} + {% endblock %} +
+
+ + +
+
+ {% block message %} + {% if message %} +

+ {{ message }} +

+ {% endif %} + {% if successmessage %} +

+ {{ successmessage }} +

+ {% endif %} + {% endblock %} +
+
+ {% load tz %} + + {% block content %}{% endblock %} +
+
+ +
+ {% block footer %} + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + + {% endblock %} +
+ {% cookielaw_banner %} +
+ + {% analytical_body_bottom %} + {% block body_bottom %}{% endblock %} + + diff --git a/templates/basefront.html b/templates/basefront.html new file mode 100644 index 00000000..9bf96b9c --- /dev/null +++ b/templates/basefront.html @@ -0,0 +1,80 @@ +{% extends "basebase.html" %} +{% block filters %} + {% load rowerfilters %} +{% endblock %} + +{% block meta %} +{% endblock %} + +{% block body_top %} + + +
+ +
+{% endblock %} + +{% block teams %} + {% if user.is_authenticated and user|has_teams %} + + See recent workouts for your team + {% elif user.is_authenticated and user.rower.team.all %} + + See recent workouts for your team + {% else %} +

 

+ {% endif %} +{% endblock %} + + +{% block body_bottom %} +
+ +{% endblock %} + diff --git a/templates/basenofilters.html b/templates/basenofilters.html new file mode 100644 index 00000000..04fad305 --- /dev/null +++ b/templates/basenofilters.html @@ -0,0 +1,26 @@ +{% extends "basebase.html" %} +{% block filters %} + {% load rowerfilters %} +{% endblock %} + +{% block teams %} + {% if user.is_authenticated and user.rower.team.all %} + + See recent workouts for your team + {% else %} +

 

+ {% endif %} +{% endblock %} + +{% block content %} + +{% endblock %}