diff --git a/rowers/middleware.py b/rowers/middleware.py
index 5f7d9c43..7c1a0164 100644
--- a/rowers/middleware.py
+++ b/rowers/middleware.py
@@ -33,7 +33,8 @@ allowed_paths = [
'/rowers/me/gdpr-optin-confirm'
'/rowers/exportallworkouts/',
'/rowers/exportallworkouts',
- '/rowers/survey/'
+ '/rowers/survey/',
+ '/rowers/me/prefs/'
]
@@ -58,6 +59,26 @@ class SurveyMiddleWare(object):
return response
+class FTPMiddleWare(object):
+ def __init__(self, get_response):
+ self.get_response = get_response
+
+ def __call__(self, request):
+ if request.user.is_authenticated and request.path not in allowed_paths:
+ r = getrower(request.user)
+ nexturl = request.path
+ if 'ftp' in nexturl: # pragma: no cover
+ nexturl = '/rowers/me/prefs/'
+ mustsetftp = not r.ftpset
+ if mustsetftp: # pragma: no cover
+ return redirect(
+ '/rowers/me/prefs/?next=%s' % nexturl
+ )
+
+ response = self.get_response(request)
+
+ return response
+
class GDPRMiddleWare(object):
def __init__(self, get_response):
diff --git a/rowers/models.py b/rowers/models.py
index e533f129..feeffc02 100644
--- a/rowers/models.py
+++ b/rowers/models.py
@@ -919,6 +919,7 @@ class Rower(models.Model):
# Privacy Data
gdproptin = models.BooleanField(default=False)
gdproptindate = models.DateTimeField(blank=True, null=True)
+ ftpset = models.BooleanField(default=False)
surveydone = models.BooleanField(default=False)
surveydonedate = models.DateTimeField(blank=True, null=True)
@@ -4220,7 +4221,20 @@ class RowerExportForm(ModelForm):
]
# Simple form to set rower's Functional Threshold Power
+class SimpleRowerPowerForm(ModelForm):
+ otwftp = forms.IntegerField(initial=0,required=False, label='FTP on water')
+ class Meta:
+ model = Rower
+ fields = ['ftp']
+ def __init__(self, *args, **kwargs):
+ super(SimpleRowerPowerForm, self).__init__(*args, **kwargs)
+ self.initial['otwftp'] = int((1-0.01*self.instance.otwslack)*self.instance.ftp)
+
+ def save(self, *args, **kwargs):
+ otwslack = -100.*(self.cleaned_data['otwftp']-self.cleaned_data['ftp'])/(self.cleaned_data['ftp'])
+ self.instance.otwslack = otwslack
+ return super(SimpleRowerPowerForm, self).save(*args, **kwargs)
class RowerPowerForm(ModelForm):
class Meta:
diff --git a/rowers/templates/rower_simplepreferences.html b/rowers/templates/rower_simplepreferences.html
new file mode 100644
index 00000000..b7b697be
--- /dev/null
+++ b/rowers/templates/rower_simplepreferences.html
@@ -0,0 +1,28 @@
+{% extends "newbase.html" %}
+{% load static %}
+{% load rowerfilters %}
+
+{% block title %}Change Rower Preferences{% endblock %}
+
+{% block main %}
+
Functional Threshold Power for {{ rower.user.first_name }} {{ rower.user.last_name }}
+
+
+
+
+
+{% endblock %}
+
+{% block sidebar %}
+{% include 'menu_profile.html' %}
+{% endblock %}
diff --git a/rowers/tests/donottest_ajax.py b/rowers/tests/donottest_ajax.py
index c415c669..c8afd59e 100644
--- a/rowers/tests/donottest_ajax.py
+++ b/rowers/tests/donottest_ajax.py
@@ -50,7 +50,7 @@ class AjaxTests(TestCase):
u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
- r = Rower.objects.create(user=u,gdproptin=True,
+ r = Rower.objects.create(user=u,gdproptin=True, ftpset=True,
gdproptindate=timezone.now()
)
self.nu = datetime.datetime.now()
diff --git a/rowers/tests/test_aavirtualevents.py b/rowers/tests/test_aavirtualevents.py
index 7cc66429..c1cbc2f6 100644
--- a/rowers/tests/test_aavirtualevents.py
+++ b/rowers/tests/test_aavirtualevents.py
@@ -20,7 +20,8 @@ class VirtualEventViewTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+
+ gdproptin=True, ftpset=True, surveydone=True,gdproptindate=timezone.now(),
rowerplan='coach')
self.c = Client()
@@ -36,7 +37,7 @@ class VirtualEventViewTest(TestCase):
self.rpiet = Rower.objects.create(user=self.upiet,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='basic')
self.piet_workouts = WorkoutFactory.create_batch(5, user=self.rpiet)
@@ -49,7 +50,7 @@ class VirtualEventViewTest(TestCase):
self.rklaas = Rower.objects.create(user=self.uklaas,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='basic')
self.klaas_workouts = WorkoutFactory.create_batch(5, user=self.rklaas)
@@ -62,7 +63,7 @@ class VirtualEventViewTest(TestCase):
self.rhenk = Rower.objects.create(user=self.uhenk,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='basic')
self.henk_workouts = WorkoutFactory.create_batch(5, user=self.rhenk)
diff --git a/rowers/tests/test_analysis.py b/rowers/tests/test_analysis.py
index 0bbda342..8835ac82 100644
--- a/rowers/tests/test_analysis.py
+++ b/rowers/tests/test_analysis.py
@@ -19,7 +19,7 @@ class ListWorkoutTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -73,7 +73,7 @@ class PlannedSessionTests(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -124,7 +124,7 @@ class ForcecurveTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -161,7 +161,7 @@ class WorkoutCompareTestNew(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -259,7 +259,7 @@ class WorkoutBoxPlotTestNew(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -356,7 +356,7 @@ class WorkoutHistoTestNew(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -453,7 +453,7 @@ class History(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -540,7 +540,7 @@ class GoldMedalScores(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -640,7 +640,7 @@ class WorkoutFlexallTestNew(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -737,7 +737,7 @@ class WorkoutStatsTestNew(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -1038,7 +1038,7 @@ class MarkerPerformanceTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -1236,7 +1236,7 @@ class AlertTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/tests/test_api.py b/rowers/tests/test_api.py
index 8b7b7673..f1a6f73b 100644
--- a/rowers/tests/test_api.py
+++ b/rowers/tests/test_api.py
@@ -33,7 +33,7 @@ class OwnApi(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',subscription_id=1)
diff --git a/rowers/tests/test_async_tasks.py b/rowers/tests/test_async_tasks.py
index 43718b36..66aa36dd 100644
--- a/rowers/tests/test_async_tasks.py
+++ b/rowers/tests/test_async_tasks.py
@@ -30,7 +30,7 @@ class AsyncTaskTests(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/tests/test_aworkouts.py b/rowers/tests/test_aworkouts.py
index db8c24f1..3f5f8f24 100644
--- a/rowers/tests/test_aworkouts.py
+++ b/rowers/tests/test_aworkouts.py
@@ -37,7 +37,7 @@ class ListWorkoutTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -95,7 +95,7 @@ class WorkoutViewTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/tests/test_basicrower.py b/rowers/tests/test_basicrower.py
index 79cae214..39a9b1f6 100644
--- a/rowers/tests/test_basicrower.py
+++ b/rowers/tests/test_basicrower.py
@@ -18,7 +18,7 @@ class SimpleViewTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
protrialexpires=datetime.date(1970,1,1),
plantrialexpires=datetime.date(1970,1,1),
diff --git a/rowers/tests/test_braintree.py b/rowers/tests/test_braintree.py
index 37c08295..9933bd15 100644
--- a/rowers/tests/test_braintree.py
+++ b/rowers/tests/test_braintree.py
@@ -65,7 +65,7 @@ class BraintreeUnits(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',subscription_id=1)
diff --git a/rowers/tests/test_courses.py b/rowers/tests/test_courses.py
index 5eee4f95..346cca15 100644
--- a/rowers/tests/test_courses.py
+++ b/rowers/tests/test_courses.py
@@ -16,7 +16,7 @@ class CourseUnitTest(TestCase):
self.u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
)
@@ -128,7 +128,7 @@ class CoursesTest(TestCase):
self.u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
)
diff --git a/rowers/tests/test_cpchart.py b/rowers/tests/test_cpchart.py
index b7895702..6752450c 100644
--- a/rowers/tests/test_cpchart.py
+++ b/rowers/tests/test_cpchart.py
@@ -20,7 +20,7 @@ class CPChartTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,sex='male',
+ gdproptin=True, ftpset=True,surveydone=True,sex='male',
weightcategory='hwt',
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/tests/test_emails.py b/rowers/tests/test_emails.py
index 2884d93b..2d3355ef 100644
--- a/rowers/tests/test_emails.py
+++ b/rowers/tests/test_emails.py
@@ -16,7 +16,7 @@ class EmailUpload(TestCase):
'koeinsloot',
first_name='John',
last_name='Sloot')
- r = Rower.objects.create(user=u,gdproptin=True,surveydone=True,
+ r = Rower.objects.create(user=u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
emailalternatives=['sander2@ds.nl']
)
@@ -24,7 +24,7 @@ class EmailUpload(TestCase):
self.theadmin = UserFactory(is_staff=True)
self.rtheadmin = Rower.objects.create(user=self.theadmin,
birthdate = faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -168,14 +168,14 @@ class EmailTests(TestCase):
u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
- r = Rower.objects.create(user=u,gdproptin=True,surveydone=True,
+ r = Rower.objects.create(user=u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
self.theadmin = UserFactory(is_staff=True)
self.rtheadmin = Rower.objects.create(user=self.theadmin,
birthdate = faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/tests/test_empower.py b/rowers/tests/test_empower.py
index 9073dd0c..ce52ff4e 100644
--- a/rowers/tests/test_empower.py
+++ b/rowers/tests/test_empower.py
@@ -14,7 +14,7 @@ class EmpowerTest(TestCase):
'sander@ds.ds',
'koeinsloot',
)
- r = Rower.objects.create(user=u,rowerplan='coach',gdproptin=True,surveydone=True,
+ r = Rower.objects.create(user=u,rowerplan='coach',gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now())
self.c = Client()
diff --git a/rowers/tests/test_flexchart.py b/rowers/tests/test_flexchart.py
index 27869afa..d66d20ea 100644
--- a/rowers/tests/test_flexchart.py
+++ b/rowers/tests/test_flexchart.py
@@ -12,7 +12,7 @@ class WorkoutViewTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
showfavoritechartnotes=True)
diff --git a/rowers/tests/test_imports.py b/rowers/tests/test_imports.py
index 5534ea5d..42a133c7 100644
--- a/rowers/tests/test_imports.py
+++ b/rowers/tests/test_imports.py
@@ -39,7 +39,7 @@ class RojaboObjects(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
@@ -91,7 +91,7 @@ class GarminObjects(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
self.r.garmintoken = 'dfdzf'
@@ -266,7 +266,7 @@ class C2Objects(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
@@ -598,7 +598,7 @@ class C2ObjectsTokenExpired(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
@@ -672,7 +672,7 @@ class NKObjects(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
@@ -824,7 +824,7 @@ class PolarObjects(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
@@ -920,7 +920,7 @@ class RP3Objects(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
@@ -1012,7 +1012,7 @@ class StravaObjects(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
strava_auto_import=True,
strava_auto_delete=True,
@@ -1189,7 +1189,7 @@ class STObjects(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
@@ -1338,7 +1338,7 @@ class TPObjects(DjangoTestCase):
self.u.first_name = 'John'
self.u.last_name = 'Sander'
self.u.save()
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
diff --git a/rowers/tests/test_interactivecharts.py b/rowers/tests/test_interactivecharts.py
index b254fce1..2d217f0b 100644
--- a/rowers/tests/test_interactivecharts.py
+++ b/rowers/tests/test_interactivecharts.py
@@ -14,7 +14,7 @@ class InteractiveChartTest(TestCase):
u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
- r = Rower.objects.create(user=u,gdproptin=True,surveydone=True,
+ r = Rower.objects.create(user=u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
self.nu = datetime.datetime.now()
diff --git a/rowers/tests/test_misc.py b/rowers/tests/test_misc.py
index f191c2b2..6725c792 100644
--- a/rowers/tests/test_misc.py
+++ b/rowers/tests/test_misc.py
@@ -16,7 +16,7 @@ class MiscTests(TestCase):
self.u = UserFactory(is_staff=True)
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',subscription_id=1)
@@ -49,7 +49,7 @@ class WorkoutTests(TestCase):
self.u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
nu = datetime.datetime.now()
@@ -69,7 +69,7 @@ class C2Tests(TestCase):
self.u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
self.nu = datetime.datetime.now()
diff --git a/rowers/tests/test_newusers.py b/rowers/tests/test_newusers.py
index e60450f0..6207d920 100644
--- a/rowers/tests/test_newusers.py
+++ b/rowers/tests/test_newusers.py
@@ -47,6 +47,7 @@ class NewUserRegistrationTest(TestCase):
# set opt-in
user = User.objects.get(username='janderoeiert')
user.rower.gdpr_optin = True
+ user.rower.ftpset = True
user.set_password('Aapindewei2')
user.is_active = True
user.save()
@@ -67,8 +68,9 @@ class NewUserRegistrationTest(TestCase):
status_code=302,target_status_code=200)
url = '/rowers/me/gdpr-optin-confirm/?next=/rowers/list-workouts/'
- response = self.c.get(url)
+ response = self.c.get(url)
+
expected = '/rowers/list-workouts/'
self.assertRedirects(response,
expected_url=expected,
diff --git a/rowers/tests/test_payments.py b/rowers/tests/test_payments.py
index f1c4ec13..5f1cf614 100644
--- a/rowers/tests/test_payments.py
+++ b/rowers/tests/test_payments.py
@@ -181,7 +181,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -240,7 +240,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -304,7 +304,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -371,7 +371,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -411,7 +411,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='plan',
paymentprocessor='braintree',
@@ -505,7 +505,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -546,7 +546,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -568,7 +568,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -615,7 +615,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -661,7 +661,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -706,7 +706,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -757,7 +757,7 @@ description: ""
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
diff --git a/rowers/tests/test_permissions.py b/rowers/tests/test_permissions.py
index 0f5a8c3e..2f527fda 100644
--- a/rowers/tests/test_permissions.py
+++ b/rowers/tests/test_permissions.py
@@ -24,7 +24,7 @@ class PlanningPermissionsCoach(TestCase):
self.rcoach = Rower.objects.create(
user=self.ucoach,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
clubsize=10,
@@ -37,7 +37,7 @@ class PlanningPermissionsCoach(TestCase):
self.rcoachee = Rower.objects.create(
user=self.ucoachee,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic'
)
@@ -62,7 +62,7 @@ class PlanningPermissionsCoach(TestCase):
self.rgroupmember = Rower.objects.create(
user=self.ugroupmember,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic'
)
@@ -107,7 +107,7 @@ class PermissionsFreeCoach(TestCase):
self.ufreecoach = UserFactory(username='coachuser')
self.rfreecoach = Rower.objects.create(user=self.ufreecoach,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='freecoach',clubsize=100)
self.coachinggroup = CoachingGroup.objects.create()
@@ -121,7 +121,7 @@ class PermissionsFreeCoach(TestCase):
self.uplan = UserFactory(username='planuser')
self.rplan = Rower.objects.create(user=self.uplan,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan')
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
@@ -133,7 +133,7 @@ class PermissionsFreeCoach(TestCase):
self.upro = UserFactory(username='prouser')
self.rpro = Rower.objects.create(user=self.upro,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='pro')
self.upro_workouts = WorkoutFactory.create_batch(5, user=self.rpro)
@@ -145,7 +145,7 @@ class PermissionsFreeCoach(TestCase):
self.uplan2 = UserFactory(username='planuser2')
self.rplan2 = Rower.objects.create(user=self.uplan2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan')
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
@@ -157,7 +157,7 @@ class PermissionsFreeCoach(TestCase):
self.upro2 = UserFactory(username='prouser2')
self.rpro2 = Rower.objects.create(user=self.upro2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='pro')
self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
@@ -169,7 +169,7 @@ class PermissionsFreeCoach(TestCase):
self.ubasic = UserFactory(username='basicuser')
self.rbasic = Rower.objects.create(user=self.ubasic,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='basic')
self.ubasic_workouts = WorkoutFactory.create_batch(5, user=self.rbasic)
@@ -285,7 +285,7 @@ class PermissionsBasicsTests(TestCase):
self.ucoach = UserFactory(username='coachuser')
self.rcoach = Rower.objects.create(user=self.ucoach,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='coach',clubsize=10)
self.ucoach_workouts = WorkoutFactory.create_batch(5, user=self.rcoach)
@@ -300,7 +300,7 @@ class PermissionsBasicsTests(TestCase):
self.uplan = UserFactory(username='planuser')
self.rplan = Rower.objects.create(user=self.uplan,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan')
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
@@ -312,7 +312,7 @@ class PermissionsBasicsTests(TestCase):
self.upro = UserFactory(username='prouser')
self.rpro = Rower.objects.create(user=self.upro,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='pro')
self.upro_workouts = WorkoutFactory.create_batch(5, user=self.rpro)
@@ -324,7 +324,7 @@ class PermissionsBasicsTests(TestCase):
self.uplan2 = UserFactory(username='planuser2')
self.rplan2 = Rower.objects.create(user=self.uplan2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan')
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
@@ -336,7 +336,7 @@ class PermissionsBasicsTests(TestCase):
self.upro2 = UserFactory(username='prouser2')
self.rpro2 = Rower.objects.create(user=self.upro2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='pro')
self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
@@ -348,7 +348,7 @@ class PermissionsBasicsTests(TestCase):
self.ubasic = UserFactory(username='basicuser')
self.rbasic = Rower.objects.create(user=self.ubasic,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='basic')
self.ubasic_workouts = WorkoutFactory.create_batch(5, user=self.rbasic)
@@ -545,7 +545,7 @@ class PermissionsViewTests(TestCase):
self.ucoach = UserFactory(username='coachuser')
self.rcoach = Rower.objects.create(user=self.ucoach,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='coach',clubsize=10)
self.ucoach_workouts = WorkoutFactory.create_batch(5, user=self.rcoach)
@@ -560,7 +560,7 @@ class PermissionsViewTests(TestCase):
self.uplan = UserFactory(username='planuser')
self.rplan = Rower.objects.create(user=self.uplan,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan')
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
@@ -572,7 +572,7 @@ class PermissionsViewTests(TestCase):
self.upro = UserFactory(username='prouser')
self.rpro = Rower.objects.create(user=self.upro,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='pro')
self.upro_workouts = WorkoutFactory.create_batch(5, user=self.rpro)
@@ -584,7 +584,7 @@ class PermissionsViewTests(TestCase):
self.uplan2 = UserFactory(username='planuser2')
self.rplan2 = Rower.objects.create(user=self.uplan2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan')
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
@@ -596,7 +596,7 @@ class PermissionsViewTests(TestCase):
self.upro2 = UserFactory(username='prouser2')
self.rpro2 = Rower.objects.create(user=self.upro2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='pro')
self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
@@ -608,7 +608,7 @@ class PermissionsViewTests(TestCase):
self.ubasic = UserFactory(username='basicuser')
self.rbasic = Rower.objects.create(user=self.ubasic,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='basic')
self.ubasic_workouts = WorkoutFactory.create_batch(5, user=self.rbasic)
@@ -1450,7 +1450,7 @@ class PermissionsCoachingTests(TestCase):
self.ucoach = UserFactory(username='coachuser')
self.rcoach = Rower.objects.create(user=self.ucoach,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='coach',clubsize=10)
self.ucoach_workouts = WorkoutFactory.create_batch(5, user=self.rcoach)
@@ -1465,7 +1465,7 @@ class PermissionsCoachingTests(TestCase):
self.uplan = UserFactory(username='planuser')
self.rplan = Rower.objects.create(user=self.uplan,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan')
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
@@ -1477,7 +1477,7 @@ class PermissionsCoachingTests(TestCase):
self.upro = UserFactory(username='prouser')
self.rpro = Rower.objects.create(user=self.upro,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='pro')
self.upro_workouts = WorkoutFactory.create_batch(5, user=self.rpro)
@@ -1489,7 +1489,7 @@ class PermissionsCoachingTests(TestCase):
self.uplan2 = UserFactory(username='planuser2')
self.rplan2 = Rower.objects.create(user=self.uplan2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan')
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
@@ -1501,7 +1501,7 @@ class PermissionsCoachingTests(TestCase):
self.upro2 = UserFactory(username='prouser2')
self.rpro2 = Rower.objects.create(user=self.upro2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='pro')
self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
@@ -1513,7 +1513,7 @@ class PermissionsCoachingTests(TestCase):
self.ubasic = UserFactory(username='basicuser')
self.rbasic = Rower.objects.create(user=self.ubasic,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='basic')
self.ubasic_workouts = WorkoutFactory.create_batch(5, user=self.rbasic)
diff --git a/rowers/tests/test_permissions2.py b/rowers/tests/test_permissions2.py
index fee5d5e7..1bd5c3d0 100644
--- a/rowers/tests/test_permissions2.py
+++ b/rowers/tests/test_permissions2.py
@@ -60,7 +60,7 @@ class PermissionsViewTests(TestCase):
ucoach = UserFactory(username='coachuser')
rcoach = Rower.objects.create(user=ucoach,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='coach',clubsize=10)
ucoach_workouts = WorkoutFactory.create_batch(5, user=rcoach)
@@ -82,7 +82,7 @@ class PermissionsViewTests(TestCase):
uplan = UserFactory(username='planuser')
rplan = Rower.objects.create(user=uplan,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan',clubsize=10)
uplan_workouts = WorkoutFactory.create_batch(5, user=rplan)
@@ -102,7 +102,7 @@ class PermissionsViewTests(TestCase):
uplan2 = UserFactory(username='plan2user')
rplan2 = Rower.objects.create(user=uplan2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='plan',clubsize=10)
uplan2_workouts = WorkoutFactory.create_batch(5, user=rplan2)
@@ -122,7 +122,7 @@ class PermissionsViewTests(TestCase):
upro = UserFactory(username='prouser')
rpro = Rower.objects.create(user=upro,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='pro',clubsize=10)
upro_workouts = WorkoutFactory.create_batch(5, user=rpro)
@@ -142,7 +142,7 @@ class PermissionsViewTests(TestCase):
ubasic = UserFactory(username='basicuser')
rbasic = Rower.objects.create(user=ubasic,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='basic',clubsize=10)
ubasic_workouts = WorkoutFactory.create_batch(5, user=rbasic)
@@ -162,7 +162,7 @@ class PermissionsViewTests(TestCase):
ustrange = UserFactory(username='strangeuser')
rstrange = Rower.objects.create(user=ustrange,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,gdproptindate=timezone.now(),
+ gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
rowerplan='basic',clubsize=10)
ustrange_workouts = WorkoutFactory.create_batch(5, user=rstrange)
diff --git a/rowers/tests/test_plans.py b/rowers/tests/test_plans.py
index 8421c62f..2a2a870d 100644
--- a/rowers/tests/test_plans.py
+++ b/rowers/tests/test_plans.py
@@ -30,7 +30,7 @@ class TrainingPlanTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
defaulttimezone='US/Pacific',
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -198,7 +198,7 @@ class SessionTemplateTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -304,7 +304,7 @@ class SessionLinkTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -548,7 +548,7 @@ class SessionCompleteTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -805,7 +805,7 @@ class ChallengeCompleteTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -1029,7 +1029,7 @@ class MandatoryTestCompleteTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -1242,7 +1242,7 @@ class PlannedSessionsView(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
defaulttimezone='US/Pacific',
rowerplan='coach')
@@ -1252,7 +1252,7 @@ class PlannedSessionsView(TestCase):
self.u2 = UserFactory(username='testbasicuser')
self.r2 = Rower.objects.create(user=self.u2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic')
@@ -1263,7 +1263,7 @@ class PlannedSessionsView(TestCase):
self.u3 = UserFactory(username='testbasicuser2')
self.r3 = Rower.objects.create(user=self.u3,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic')
diff --git a/rowers/tests/test_races.py b/rowers/tests/test_races.py
index 2da85163..ebf0ac06 100644
--- a/rowers/tests/test_races.py
+++ b/rowers/tests/test_races.py
@@ -58,21 +58,21 @@ class ChallengesTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=datetime.datetime.now()-datetime.timedelta(days=25*365),
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
self.u2 = UserFactory()
self.r2 = Rower.objects.create(user=self.u2,
birthdate=datetime.datetime.now()-datetime.timedelta(days=28*365),
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic')
self.u3 = UserFactory()
self.follower = Rower.objects.create(user=self.u3,
birthdate=datetime.datetime.now()-datetime.timedelta(days=28*365),
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic')
@@ -933,7 +933,7 @@ class IndoorChallengesTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=datetime.datetime.now()-datetime.timedelta(days=25*365),
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/tests/test_rowerplans.py b/rowers/tests/test_rowerplans.py
index 557d148b..e662bf2c 100644
--- a/rowers/tests/test_rowerplans.py
+++ b/rowers/tests/test_rowerplans.py
@@ -15,7 +15,7 @@ class TrialsTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic')
diff --git a/rowers/tests/test_settings.py b/rowers/tests/test_settings.py
index 256c7aa0..86dc231d 100644
--- a/rowers/tests/test_settings.py
+++ b/rowers/tests/test_settings.py
@@ -14,7 +14,7 @@ class DataTest(TestCase):
u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
- r = Rower.objects.create(user=u,gdproptin=True,surveydone=True,
+ r = Rower.objects.create(user=u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now()
)
self.nu = datetime.datetime.now()
diff --git a/rowers/tests/test_simplefunctions.py b/rowers/tests/test_simplefunctions.py
index bad488cd..155efefb 100644
--- a/rowers/tests/test_simplefunctions.py
+++ b/rowers/tests/test_simplefunctions.py
@@ -39,7 +39,7 @@ class SimpleViewTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True, surveydone=True,
+ gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/tests/test_staticcharts.py b/rowers/tests/test_staticcharts.py
index 1710717e..3fad9dfe 100644
--- a/rowers/tests/test_staticcharts.py
+++ b/rowers/tests/test_staticcharts.py
@@ -18,7 +18,7 @@ class PlotTests(TestCase):
'sander@ds.ds',
'koeinsloot')
r = Rower.objects.create(user=u,
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic')
self.nu = datetime.datetime.now()
diff --git a/rowers/tests/test_team.py b/rowers/tests/test_team.py
index 10c43b91..9deb3639 100644
--- a/rowers/tests/test_team.py
+++ b/rowers/tests/test_team.py
@@ -41,7 +41,7 @@ class TeamTest(TestCase):
r = Rower.objects.create(
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
user=u,
@@ -400,7 +400,7 @@ class TeamTestLowLevel(TestCase):
r = Rower.objects.create(
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
user=u,
diff --git a/rowers/tests/test_unit_tests.py b/rowers/tests/test_unit_tests.py
index 1a8f6d27..854185df 100644
--- a/rowers/tests/test_unit_tests.py
+++ b/rowers/tests/test_unit_tests.py
@@ -30,7 +30,7 @@ class OtherUnitTests(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
defaulttimezone='US/Pacific',
rowerplan='coach')
@@ -166,7 +166,7 @@ class PlannedSessionTests(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -180,7 +180,7 @@ class PlannedSessionTests(TestCase):
self.u2 = UserFactory(username='testbasicuser')
self.r2 = Rower.objects.create(user=self.u2,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic')
@@ -423,7 +423,7 @@ class DataPrepTests(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
sex='male',
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -643,7 +643,7 @@ class InteractivePlotTests(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/tests/test_units.py b/rowers/tests/test_units.py
index 50af715f..68754ddc 100644
--- a/rowers/tests/test_units.py
+++ b/rowers/tests/test_units.py
@@ -25,7 +25,7 @@ class ForceUnits(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -166,7 +166,7 @@ class TestForceUnit(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/tests/test_uploads.py b/rowers/tests/test_uploads.py
index 196c69b7..9c6ba94b 100644
--- a/rowers/tests/test_uploads.py
+++ b/rowers/tests/test_uploads.py
@@ -19,7 +19,7 @@ class ViewTest(TestCase):
self.u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
- self.r = Rower.objects.create(user=self.u,gdproptin=True,surveydone=True,
+ self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
)
diff --git a/rowers/tests/test_urls.py b/rowers/tests/test_urls.py
index b8986110..9a15d993 100644
--- a/rowers/tests/test_urls.py
+++ b/rowers/tests/test_urls.py
@@ -24,7 +24,7 @@ class URLTests(TestCase):
'sander@ds.ds',
'koeinsloot',
)
- r = Rower.objects.create(user=u,rowerplan='coach',gdproptin=True,
+ r = Rower.objects.create(user=u,rowerplan='coach',gdproptin=True, ftpset=True,
gdproptindate=timezone.now())
self.c = Client()
diff --git a/rowers/tests/test_user.py b/rowers/tests/test_user.py
index 125ec651..c7ad696d 100644
--- a/rowers/tests/test_user.py
+++ b/rowers/tests/test_user.py
@@ -80,7 +80,7 @@ class UserPreferencesTest(TestCase):
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
- gdproptin=True,surveydone=True,
+ gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
diff --git a/rowers/urls.py b/rowers/urls.py
index fe555ae3..cd51fe38 100644
--- a/rowers/urls.py
+++ b/rowers/urls.py
@@ -782,10 +782,14 @@ urlpatterns = [
views.rower_edit_view, name='rower_edit_view'),
re_path(r'^me/preferences/$', views.rower_prefs_view,
name='rower_prefs_view'),
+ re_path(r'^me/prefs/$', views.rower_simpleprefs_view,
+ name='rower_simpleprefs_view'),
re_path(r'^me/transactions/$', views.transactions_view,
name='transactions_view'),
re_path(r'^me/preferences/user/(?P\d+)/$',
views.rower_prefs_view, name='rower_prefs_view'),
+ re_path(r'^me/prefs/user/(?P\d+)/$',
+ views.rower_simpleprefs_view, name='rower_simpleprefs_view'),
re_path(r'^me/edit/(.+.*)/$', views.rower_edit_view, name='rower_edit_view'),
re_path(r'^me/c2authorize/$', views.rower_c2_authorize,
name='rower_c2_authorize'),
diff --git a/rowers/views/statements.py b/rowers/views/statements.py
index 9aa224db..93a8350d 100644
--- a/rowers/views/statements.py
+++ b/rowers/views/statements.py
@@ -159,7 +159,7 @@ from rowers.models import (
VirtualRaceFollower, TombStone, InstantPlan,
PlannedSessionStep,InStrokeAnalysis, ForceCurveAnalysis
)
-from rowers.models import ( RowerPowerForm, RowerHRZonesForm,
+from rowers.models import ( RowerPowerForm, RowerHRZonesForm, SimpleRowerPowerForm,
RowerForm, RowerCPForm, GraphImage, AdvancedWorkoutForm,
RowerPowerZonesForm, AccountRowerForm, UserForm, Team, TeamForm,
TeamInviteForm, TeamInvite, TeamRequest, WorkoutComment,
diff --git a/rowers/views/userviews.py b/rowers/views/userviews.py
index cd744ffd..93aded31 100644
--- a/rowers/views/userviews.py
+++ b/rowers/views/userviews.py
@@ -551,6 +551,46 @@ def rower_edit_view(request, rowerid=0, userid=0, message=""):
'rower': r,
})
+#simple initial settings page
+@login_required()
+@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
+def rower_simpleprefs_view(request, userid=0):
+ r = getrequestrowercoachee(request, userid=userid, notpermanent=True)
+
+ breadcrumbs = [
+ {
+ 'url': '/rowers/me/edit/',
+ 'name': 'Profile'
+ },
+ {
+ 'url': reverse('rower_simpleprefs_view'),
+ 'name': 'Zones'
+ }
+ ]
+
+ form = SimpleRowerPowerForm(instance=r)
+
+ if request.method == 'POST':
+ form = SimpleRowerPowerForm(request.POST, instance=r)
+ if form.is_valid():
+ form.save(commit=True)
+ messages.info(request,'FTP and OTW FTP saved')
+ if not r.ftpset:
+ r.ftpset = True
+ r.save()
+ nexturl = request.GET.get('next', '/rowers/list-workouts/')
+ return HttpResponseRedirect(nexturl)
+
+
+ return render(request, 'rower_simplepreferences.html',
+ {
+ 'form': form,
+ 'teams': get_my_teams(request.user),
+ 'breadcrumbs': breadcrumbs,
+ 'rower': r,
+ })
+
+
# Page where user can set his details
# Add email address to form so user can change his email address
diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py
index ac70ff84..c9405151 100644
--- a/rowsandall_app/settings.py
+++ b/rowsandall_app/settings.py
@@ -107,6 +107,7 @@ MIDDLEWARE = [
'rowers.middleware.GDPRMiddleWare',
# 'rowers.middleware.PowerTimeFitnessMetricMiddleWare',
'rowers.middleware.RowerPlanMiddleWare',
+ 'rowers.middleware.FTPMiddleWare',
]
ROOT_URLCONF = 'rowsandall_app.urls'