Merge branch 'feature/django4' into develop
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rowsandall_app.settings_dev')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,240 @@
|
||||
amqp==2.4.2
|
||||
apipkg==1.5
|
||||
appdirs==1.4.3
|
||||
arcgis==1.6.0
|
||||
arrow==1.0.2
|
||||
asgiref==3.4.1
|
||||
asn1crypto==0.24.0
|
||||
atomicwrites==1.3.0
|
||||
attrs==19.1.0
|
||||
backcall==0.1.0
|
||||
backports.zoneinfo==0.2.1
|
||||
beautifulsoup4==4.7.1
|
||||
billiard==3.6.0.0
|
||||
bleach==3.1.0
|
||||
bokeh==2.2.3
|
||||
boto==2.49.0
|
||||
boto3==1.17.45
|
||||
botocore==1.20.45
|
||||
bottle==0.12.18
|
||||
braintree==3.55.0
|
||||
cairocffi==1.0.2
|
||||
celery==4.3.0
|
||||
certifi==2019.3.9
|
||||
cffi==1.14.0
|
||||
chardet==3.0.4
|
||||
Click==7.0
|
||||
cloudpickle==1.2.2
|
||||
colorama==0.4.1
|
||||
colorclass==2.2.0
|
||||
cookies==2.2.1
|
||||
coreapi==2.3.3
|
||||
coreschema==0.0.4
|
||||
coverage==5.5
|
||||
cryptography==3.4.7
|
||||
cycler==0.10.0
|
||||
Cython==0.29.21
|
||||
dask==2.20.0
|
||||
decorator==4.4.0
|
||||
defusedxml==0.5.0
|
||||
Django==2.1.7
|
||||
django-analytical==2.5.0
|
||||
django-async-messages==0.3.1
|
||||
django-braces==1.13.0
|
||||
django-classy-tags==0.8.0
|
||||
django-cookie-law==2.0.1
|
||||
django-cors-headers==2.5.2
|
||||
django-countries==5.3.3
|
||||
django-datetime-widget==0.9.3
|
||||
django-debug-toolbar==2.0
|
||||
django-extensions==2.1.6
|
||||
django-htmlmin==0.11.0
|
||||
django-leaflet==0.24.0
|
||||
django-mailbox==4.8.0
|
||||
django-oauth-toolkit==1.2.0
|
||||
django-oauth2-provider==0.2.6.1
|
||||
django-picklefield==2.1.1
|
||||
django-redis==4.10.0
|
||||
django-rest-framework==0.1.0
|
||||
django-rest-swagger==2.2.0
|
||||
django-rq==2.4.1
|
||||
django-rq-dashboard==0.3.3
|
||||
django-ses==2.0.0
|
||||
django-shell-plus==1.1.7
|
||||
django-social-share==1.3.2
|
||||
django-suit==0.2.28
|
||||
django-taggit==1.3.0
|
||||
django-tz-detect==0.2.9
|
||||
djangorestframework==3.9.2
|
||||
docopt==0.6.2
|
||||
docutils==0.14
|
||||
entrypoints==0.3
|
||||
execnet==1.5.0
|
||||
factory-boy==2.11.1
|
||||
Faker==1.0.4
|
||||
fastparquet==0.5.0
|
||||
fitparse==1.2.0
|
||||
Flask==1.0.2
|
||||
fonttools==4.28.2
|
||||
fsspec==0.5.2
|
||||
future==0.17.1
|
||||
geocoder==1.38.1
|
||||
geoip2==3.0.0
|
||||
geos==0.2.1
|
||||
grpcio==1.26.0
|
||||
grpcio-tools==1.26.0
|
||||
gunicorn==20.0.4
|
||||
holoviews==1.13.5
|
||||
html5lib==1.0.1
|
||||
htmlmin==0.1.12
|
||||
HTMLParser==0.0.2
|
||||
httplib2==0.12.1
|
||||
humanize==3.3.0
|
||||
hvplot==0.4.0
|
||||
icalendar==4.0.3
|
||||
idna==2.8
|
||||
image==1.5.27
|
||||
importlib-resources==1.0.2
|
||||
ipykernel==5.1.0
|
||||
ipython==7.22.0
|
||||
ipython-genutils==0.2.0
|
||||
ipywidgets==7.4.2
|
||||
iso8601==0.1.12
|
||||
isodate==0.6.0
|
||||
itsdangerous==1.1.0
|
||||
itypes==1.1.0
|
||||
jedi==0.18.0
|
||||
jeepney==0.6.0
|
||||
Jinja2==2.10
|
||||
jmespath==0.10.0
|
||||
json5==0.8.5
|
||||
jsonschema==3.0.1
|
||||
jupyter==1.0.0
|
||||
jupyter-client==6.1.7
|
||||
jupyter-console==6.2.0
|
||||
jupyter-core==4.7.0
|
||||
jupyterlab==0.35.6
|
||||
jupyterlab-server==0.2.0
|
||||
keyring==18.0.0
|
||||
kiwisolver==1.0.1
|
||||
kombu==4.5.0
|
||||
llvmlite==0.36.0
|
||||
lxml==4.7.1
|
||||
Markdown==3.0.1
|
||||
MarkupSafe==1.1.1
|
||||
matplotlib==3.5.0
|
||||
maxminddb==1.5.4
|
||||
MiniMockTest==0.5
|
||||
mistune==0.8.4
|
||||
mock==2.0.0
|
||||
more-itertools==6.0.0
|
||||
mpld3==0.3
|
||||
mysqlclient==1.4.2.post1
|
||||
nbconvert==5.4.1
|
||||
nbformat==4.4.0
|
||||
newrelic==5.2.1.129
|
||||
nose==1.3.7
|
||||
nose-parameterized==0.6.0
|
||||
notebook==5.7.6
|
||||
numba==0.53.1
|
||||
numpy==1.18.5
|
||||
oauth2==1.9.0.post1
|
||||
oauthlib==3.0.1
|
||||
openapi-codec==1.3.2
|
||||
packaging==21.3
|
||||
pandas==1.2.4
|
||||
pandocfilters==1.4.2
|
||||
panel==0.10.1
|
||||
param==1.10.0
|
||||
parameterized==0.8.1
|
||||
parso==0.8.2
|
||||
pathspec==0.5.9
|
||||
pbr==5.1.3
|
||||
pendulum==2.1.2
|
||||
pexpect==4.6.0
|
||||
pickleshare==0.7.5
|
||||
Pillow==8.0.1
|
||||
pip-upgrader==1.4.6
|
||||
pluggy==0.9.0
|
||||
prometheus-client==0.6.0
|
||||
prompt-toolkit==2.0.9
|
||||
protobuf==3.11.1
|
||||
psycopg2==2.8.1
|
||||
ptyprocess==0.6.0
|
||||
py==1.8.0
|
||||
pyarrow==2.0.0
|
||||
pycairo==1.19.0
|
||||
pycparser==2.19
|
||||
pyct==0.4.8
|
||||
Pygments==2.3.1
|
||||
PyJWT==2.1.0
|
||||
pyOpenSSL==20.0.1
|
||||
pyparsing==2.3.1
|
||||
pyrsistent==0.14.11
|
||||
pyshp==2.1.0
|
||||
pytest==4.3.1
|
||||
pytest-django==3.4.8
|
||||
pytest-forked==1.0.2
|
||||
pytest-runner==4.4
|
||||
pytest-sugar==0.9.2
|
||||
pytest-xdist==1.27.0
|
||||
python-dateutil==2.8.0
|
||||
python-memcached==1.59
|
||||
python-twitter==3.5
|
||||
pytz==2020.1
|
||||
pytzdata==2020.1
|
||||
pyviz-comms==0.7.6
|
||||
pywin32-ctypes==0.2.0
|
||||
PyYAML==5.1
|
||||
pyzmq==18.0.1
|
||||
qtconsole==4.4.3
|
||||
ratelim==0.1.6
|
||||
rauth==0.7.3
|
||||
redis==3.5.3
|
||||
requests==2.23.0
|
||||
requests-oauthlib==1.2.0
|
||||
rowingdata==3.4.9
|
||||
rowingphysics==0.5.0
|
||||
rq==1.8.0
|
||||
rules==2.1
|
||||
ruptures==1.1.3
|
||||
s3transfer==0.3.4
|
||||
scipy==1.5.4
|
||||
SecretStorage==3.3.1
|
||||
Send2Trash==1.5.0
|
||||
setuptools-scm==6.3.2
|
||||
shell==1.0.1
|
||||
shortuuid==0.5.0
|
||||
simplejson==3.17.2
|
||||
six==1.12.0
|
||||
soupsieve==1.8
|
||||
SQLAlchemy==1.3.1
|
||||
sqlparse==0.3.0
|
||||
stravalib==0.10.4
|
||||
termcolor==1.1.0
|
||||
terminado==0.8.1
|
||||
terminaltables==3.1.0
|
||||
testpath==0.4.2
|
||||
text-unidecode==1.2
|
||||
thrift==0.11.0
|
||||
timezonefinder==5.2.0
|
||||
tk==0.1.0
|
||||
tomli==1.2.2
|
||||
toolz==0.10.0
|
||||
tornado==6.0.1
|
||||
tqdm==4.31.1
|
||||
traitlets==4.3.2
|
||||
typing-extensions==3.7.4.3
|
||||
units==0.7
|
||||
uritemplate==3.0.0
|
||||
urllib3==1.25.9
|
||||
VerbalExpressions==0.0.2
|
||||
vine==1.3.0
|
||||
wcwidth==0.1.7
|
||||
webencodings==0.5.1
|
||||
Werkzeug==0.15.1
|
||||
widgetsnbextension==3.4.2
|
||||
xlrd==1.2.0
|
||||
xmltodict==0.12.0
|
||||
yamjam==0.1.7
|
||||
yamllint==1.15.0
|
||||
@@ -0,0 +1,258 @@
|
||||
amqp==5.0.7
|
||||
anyio==3.4.0
|
||||
apipkg==1.5
|
||||
appdirs==1.4.3
|
||||
arcgis==1.6.0
|
||||
argon2-cffi==21.3.0
|
||||
argon2-cffi-bindings==21.2.0
|
||||
arrow==1.0.2
|
||||
asgiref==3.4.1
|
||||
asn1crypto==0.24.0
|
||||
atomicwrites==1.3.0
|
||||
attrs==19.1.0
|
||||
Babel==2.9.1
|
||||
backcall==0.1.0
|
||||
backports.zoneinfo==0.2.1
|
||||
beautifulsoup4==4.7.1
|
||||
billiard==3.6.4.0
|
||||
bleach==4.1.0
|
||||
bokeh==2.2.3
|
||||
boto==2.49.0
|
||||
boto3==1.17.45
|
||||
botocore==1.20.45
|
||||
bottle==0.12.19
|
||||
braintree==3.55.0
|
||||
cairocffi==1.0.2
|
||||
celery==5.2.1
|
||||
certifi==2019.3.9
|
||||
cffi==1.14.0
|
||||
chardet==3.0.4
|
||||
click==8.0.3
|
||||
click-didyoumean==0.3.0
|
||||
click-plugins==1.1.1
|
||||
click-repl==0.2.0
|
||||
cloudpickle==1.2.2
|
||||
colorama==0.4.1
|
||||
colorclass==2.2.0
|
||||
cookies==2.2.1
|
||||
coreapi==2.3.3
|
||||
coreschema==0.0.4
|
||||
coverage==5.5
|
||||
cryptography==3.4.7
|
||||
cycler==0.10.0
|
||||
Cython==0.29.21
|
||||
dask==2021.12.0
|
||||
decorator==4.4.0
|
||||
defusedxml==0.5.0
|
||||
Django==3.2.10
|
||||
django-analytical==2.5.0
|
||||
django-async-messages==0.3.1
|
||||
django-braces==1.13.0
|
||||
django-classy-tags==0.8.0
|
||||
django-cookie-law==2.0.1
|
||||
django-cors-headers==3.10.1
|
||||
django-countries==7.2.1
|
||||
django-datetime-widget2==0.9.5
|
||||
django-debug-toolbar==2.0
|
||||
django-extensions==2.1.6
|
||||
django-htmlmin==0.11.0
|
||||
django-leaflet==0.28.2
|
||||
django-mailbox==4.8.2
|
||||
django-oauth-toolkit==1.2.0
|
||||
django-oauth2-provider==0.2.6.1
|
||||
django-picklefield==2.1.1
|
||||
django-redis==4.10.0
|
||||
django-rest-framework==0.1.0
|
||||
django-rest-swagger==2.2.0
|
||||
django-rq==2.4.1
|
||||
django-rq-dashboard==0.3.3
|
||||
django-ses==2.0.0
|
||||
django-shell-plus==1.1.7
|
||||
django-social-share==1.3.2
|
||||
django-suit==0.2.28
|
||||
django-taggit==1.3.0
|
||||
django-tz-detect==0.2.9
|
||||
djangorestframework==3.13.0
|
||||
docopt==0.6.2
|
||||
docutils==0.14
|
||||
dparse==0.5.1
|
||||
entrypoints==0.3
|
||||
execnet==1.5.0
|
||||
factory-boy==2.11.1
|
||||
Faker==1.0.4
|
||||
fastparquet==0.5.0
|
||||
fitparse==1.2.0
|
||||
Flask==1.0.2
|
||||
fonttools==4.28.2
|
||||
fsspec==2021.11.1
|
||||
future==0.17.1
|
||||
geocoder==1.38.1
|
||||
geoip2==3.0.0
|
||||
geos==0.2.1
|
||||
grpcio==1.26.0
|
||||
grpcio-tools==1.26.0
|
||||
gunicorn==20.0.4
|
||||
holoviews==1.13.5
|
||||
html5lib==1.1
|
||||
htmlmin==0.1.12
|
||||
HTMLParser==0.0.2
|
||||
httplib2==0.20.2
|
||||
humanize==3.3.0
|
||||
hvplot==0.4.0
|
||||
icalendar==4.0.3
|
||||
idna==2.8
|
||||
image==1.5.27
|
||||
importlib-resources==1.0.2
|
||||
ipykernel==5.1.0
|
||||
ipython==7.22.0
|
||||
ipython-genutils==0.2.0
|
||||
ipywidgets==7.4.2
|
||||
iso8601==0.1.12
|
||||
isodate==0.6.0
|
||||
itsdangerous==1.1.0
|
||||
itypes==1.2.0
|
||||
jedi==0.18.0
|
||||
jeepney==0.6.0
|
||||
Jinja2==3.0.3
|
||||
jmespath==0.10.0
|
||||
json5==0.8.5
|
||||
jsonschema==3.0.1
|
||||
jupyter==1.0.0
|
||||
jupyter-client==6.1.7
|
||||
jupyter-console==6.2.0
|
||||
jupyter-core==4.7.0
|
||||
jupyter-server==1.13.1
|
||||
jupyterlab==3.2.5
|
||||
jupyterlab-server==2.9.0
|
||||
keyring==18.0.0
|
||||
kiwisolver==1.0.1
|
||||
kombu==5.2.2
|
||||
llvmlite==0.36.0
|
||||
locket==0.2.1
|
||||
lxml==4.7.1
|
||||
Markdown==3.0.1
|
||||
MarkupSafe==2.0.1
|
||||
matplotlib==3.5.0
|
||||
maxminddb==1.5.4
|
||||
MiniMockTest==0.5
|
||||
mistune==0.8.4
|
||||
mock==2.0.0
|
||||
more-itertools==6.0.0
|
||||
mpld3==0.3
|
||||
mysqlclient==1.4.2.post1
|
||||
nbclassic==0.3.4
|
||||
nbconvert==5.4.1
|
||||
nbformat==4.4.0
|
||||
nest-asyncio==1.5.4
|
||||
newrelic==5.2.1.129
|
||||
nose==1.3.7
|
||||
nose-parameterized==0.6.0
|
||||
notebook==6.4.6
|
||||
numba==0.53.1
|
||||
numpy==1.18.5
|
||||
oauth2==1.9.0.post1
|
||||
oauth2-provider==0.0
|
||||
oauthlib==3.0.1
|
||||
openapi-codec==1.3.2
|
||||
packaging==21.3
|
||||
pandas==1.2.4
|
||||
pandocfilters==1.4.2
|
||||
panel==0.10.1
|
||||
param==1.10.0
|
||||
parameterized==0.8.1
|
||||
parso==0.8.2
|
||||
partd==1.2.0
|
||||
pathspec==0.5.9
|
||||
pbr==5.1.3
|
||||
pendulum==2.1.2
|
||||
pexpect==4.6.0
|
||||
pickleshare==0.7.5
|
||||
Pillow==8.4.0
|
||||
pip-upgrader==1.4.6
|
||||
pluggy==0.9.0
|
||||
prometheus-client==0.6.0
|
||||
prompt-toolkit==2.0.9
|
||||
protobuf==3.11.1
|
||||
psycopg2==2.8.1
|
||||
ptyprocess==0.6.0
|
||||
py==1.11.0
|
||||
pyarrow==2.0.0
|
||||
pycairo==1.19.0
|
||||
pycparser==2.19
|
||||
pyct==0.4.8
|
||||
Pygments==2.3.1
|
||||
PyJWT==2.1.0
|
||||
pyOpenSSL==20.0.1
|
||||
pyparsing==3.0.6
|
||||
pyrsistent==0.14.11
|
||||
pyshp==2.1.0
|
||||
pytest==4.3.1
|
||||
pytest-django==3.4.8
|
||||
pytest-forked==1.0.2
|
||||
pytest-runner==4.4
|
||||
pytest-sugar==0.9.2
|
||||
pytest-xdist==1.27.0
|
||||
python-dateutil==2.8.0
|
||||
python-memcached==1.59
|
||||
python-twitter==3.5
|
||||
pytz==2020.1
|
||||
pytzdata==2020.1
|
||||
pyviz-comms==0.7.6
|
||||
pywin32-ctypes==0.2.0
|
||||
PyYAML==6.0
|
||||
pyzmq==18.0.1
|
||||
qtconsole==4.4.3
|
||||
ratelim==0.1.6
|
||||
rauth==0.7.3
|
||||
redis==3.5.3
|
||||
requests==2.23.0
|
||||
requests-oauthlib==1.2.0
|
||||
rowingdata==3.4.9
|
||||
rowingphysics==0.5.0
|
||||
rq==1.8.0
|
||||
rules==3.0
|
||||
ruptures==1.1.3
|
||||
s3transfer==0.3.4
|
||||
safety==1.10.3
|
||||
scipy==1.5.4
|
||||
SecretStorage==3.3.1
|
||||
Send2Trash==1.8.0
|
||||
setuptools-scm==6.3.2
|
||||
shell==1.0.1
|
||||
shortuuid==0.5.0
|
||||
simplejson==3.17.2
|
||||
six==1.12.0
|
||||
sniffio==1.2.0
|
||||
soupsieve==1.8
|
||||
SQLAlchemy==1.3.1
|
||||
sqlparse==0.3.0
|
||||
stravalib==0.10.4
|
||||
termcolor==1.1.0
|
||||
terminado==0.12.1
|
||||
terminaltables==3.1.0
|
||||
testpath==0.4.2
|
||||
text-unidecode==1.2
|
||||
thrift==0.15.0
|
||||
timezonefinder==5.2.0
|
||||
tk==0.1.0
|
||||
toml==0.10.2
|
||||
tomli==1.2.2
|
||||
toolz==0.10.0
|
||||
tornado==6.1
|
||||
tqdm==4.31.1
|
||||
traitlets==4.3.2
|
||||
typing_extensions==4.0.1
|
||||
units==0.7
|
||||
uritemplate==3.0.0
|
||||
urllib3==1.25.9
|
||||
VerbalExpressions==0.0.2
|
||||
vine==5.0.0
|
||||
wcwidth==0.1.7
|
||||
webencodings==0.5.1
|
||||
websocket-client==1.2.3
|
||||
Werkzeug==0.15.1
|
||||
widgetsnbextension==3.4.2
|
||||
xlrd==1.2.0
|
||||
xmltodict==0.12.0
|
||||
yamjam==0.1.7
|
||||
yamllint==1.15.0
|
||||
+1
-1
@@ -5,6 +5,6 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
# Store metadata for the app
|
||||
# Store metadata for the app
|
||||
class RowersConfig(AppConfig):
|
||||
name = 'rowers'
|
||||
|
||||
@@ -266,6 +266,7 @@ def createcourse(
|
||||
country = g.json['country']
|
||||
else: # pragma: no cover
|
||||
country = 'unknown'
|
||||
|
||||
c.country = country
|
||||
c.save()
|
||||
obj = GeoPoint(
|
||||
|
||||
@@ -8,7 +8,6 @@ from django.urls import reverse
|
||||
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.utils.decorators import available_attrs
|
||||
from django.contrib import messages
|
||||
|
||||
try:
|
||||
@@ -28,7 +27,7 @@ def user_passes_test(test_func, message=default_message,login_url=None,redirect_
|
||||
that takes the user object and returns True if the user passes.
|
||||
"""
|
||||
def decorator(view_func):
|
||||
@wraps(view_func, assigned=available_attrs(view_func))
|
||||
#@wraps(view_func, assigned=available_attrs(view_func))
|
||||
def _wrapped_view(request, *args, **kwargs):
|
||||
if request.user.is_anonymous:
|
||||
url = reverse('login')+'?next='+request.path
|
||||
|
||||
@@ -32,7 +32,6 @@ from uuid import uuid4
|
||||
|
||||
|
||||
# Django
|
||||
from django.shortcuts import render_to_response
|
||||
from django.http import HttpResponseRedirect, HttpResponse,JsonResponse
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
|
||||
@@ -1926,7 +1926,7 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
|
||||
df.sort_values(['date'],inplace=True)
|
||||
df = df.groupby(['date']).max()
|
||||
df['date'] = df.index.values
|
||||
mask = df['date'] > np.datetime64(startdate)
|
||||
mask = df['date'] > np.datetime64(startdate.astimezone(tz=datetime.timezone.utc).replace(tzinfo=None))
|
||||
df = df.loc[mask]
|
||||
|
||||
|
||||
|
||||
+27
-23
@@ -4,7 +4,6 @@ from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
import uuid
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
from django.db import models,IntegrityError
|
||||
from django.contrib.auth.models import User
|
||||
@@ -16,7 +15,8 @@ from django.dispatch import receiver
|
||||
from django.forms.widgets import SplitDateTimeWidget,SelectDateWidget
|
||||
#from django.forms.extras.widgets import SelectDateWidget
|
||||
from django.forms.formsets import BaseFormSet
|
||||
from datetimewidget.widgets import DateTimeWidget
|
||||
|
||||
#from datetimewidget.widgets import DateTimeWidget
|
||||
from django.contrib.admin.widgets import AdminDateWidget,AdminTimeWidget,AdminSplitDateTime
|
||||
from django.core.validators import validate_email
|
||||
import os
|
||||
@@ -403,7 +403,7 @@ class PowerTimeFitnessMetric(models.Model):
|
||||
class Meta:
|
||||
db_table = 'powertimefitnessmetric'
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class C2WorldClassAgePerformance(models.Model):
|
||||
weightcategories = mytypes.weightcategories
|
||||
|
||||
@@ -445,7 +445,7 @@ class C2WorldClassAgePerformance(models.Model):
|
||||
return thestring
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class Team(models.Model):
|
||||
choices = (
|
||||
('private','private'),
|
||||
@@ -742,7 +742,7 @@ paymentprocessors = (
|
||||
('braintree','BrainTree')
|
||||
)
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class PaidPlan(models.Model):
|
||||
shortname = models.CharField(max_length=50,choices=plans)
|
||||
name = models.CharField(max_length=200)
|
||||
@@ -769,7 +769,7 @@ class PaidPlan(models.Model):
|
||||
paymentprocessor = self.paymentprocessor,
|
||||
)
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class CoachingGroup(models.Model):
|
||||
name = models.CharField(default='group',max_length=30,null=True,blank=True)
|
||||
|
||||
@@ -787,7 +787,7 @@ class CoachingGroup(models.Model):
|
||||
return Rower.objects.filter(mycoachgroup=self)
|
||||
|
||||
# Extension of User with rowing specific data
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class Rower(models.Model):
|
||||
adaptivetypes = mytypes.adaptivetypes
|
||||
stravatypes = (
|
||||
@@ -879,7 +879,7 @@ class Rower(models.Model):
|
||||
default='braintree')
|
||||
|
||||
eurocredits = models.IntegerField(default=0)
|
||||
|
||||
|
||||
paidplan = models.ForeignKey(PaidPlan,null=True,default=None,on_delete=models.SET_NULL)
|
||||
|
||||
planexpires = models.DateField(default=current_day)
|
||||
@@ -1439,7 +1439,7 @@ timezones = (
|
||||
|
||||
# models related to geo data (points, polygon, courses)
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class GeoCourse(models.Model):
|
||||
manager = models.ForeignKey(Rower,null=True,on_delete=models.SET_NULL)
|
||||
distance = models.IntegerField(default=0)
|
||||
@@ -1475,7 +1475,7 @@ class GeoCourseEditForm(ModelForm):
|
||||
'notes': forms.Textarea,
|
||||
}
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class GeoPolygon(models.Model):
|
||||
name = models.CharField(max_length=150,blank=True)
|
||||
course = models.ForeignKey(GeoCourse, blank=True,on_delete=models.CASCADE,related_name='polygons')
|
||||
@@ -1598,7 +1598,9 @@ class InstantPlan(models.Model):
|
||||
return self.name
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.yaml.open(mode="r")
|
||||
yamltext = self.yaml.read()
|
||||
self.yaml.close()
|
||||
|
||||
authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN
|
||||
url = settings.WORKOUTS_FIT_URL+"/trainingplan/"
|
||||
@@ -1630,7 +1632,7 @@ class InstantPlanForm(ModelForm):
|
||||
'yaml',
|
||||
]
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class TrainingPlan(models.Model):
|
||||
|
||||
statuschoices = (
|
||||
@@ -2035,7 +2037,7 @@ def macrocyclecheckdates(plan): # pragma: no cover
|
||||
pass
|
||||
cycles = cycles[1:]
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class TrainingMacroCycle(models.Model):
|
||||
plan = models.ForeignKey(TrainingPlan,on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=150,blank=True)
|
||||
@@ -2124,7 +2126,7 @@ class TrainingMacroCycleForm(ModelForm):
|
||||
'enddate': AdminDateWidget()
|
||||
}
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class TrainingMesoCycle(models.Model):
|
||||
plan = models.ForeignKey(TrainingMacroCycle,on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=150,blank=True)
|
||||
@@ -2204,7 +2206,7 @@ class TrainingMesoCycle(models.Model):
|
||||
createmicrofillers(self)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class TrainingMicroCycle(models.Model):
|
||||
plan = models.ForeignKey(TrainingMesoCycle,on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=150,blank=True)
|
||||
@@ -2301,7 +2303,7 @@ regularsessiontypechoices = (
|
||||
)
|
||||
|
||||
# model for Planned Session (Workout, Challenge, Test)
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class PlannedSession(models.Model):
|
||||
|
||||
sessiontypechoices = (
|
||||
@@ -2605,7 +2607,7 @@ registerchoices = (
|
||||
('manual','Manual - select below'),
|
||||
)
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class VirtualRace(PlannedSession):
|
||||
# has_registration = models.BooleanField(default=False)
|
||||
registration_form = models.CharField(
|
||||
@@ -3187,7 +3189,7 @@ class Workout(models.Model):
|
||||
starttime = models.TimeField(default=timezone.now)
|
||||
startdatetime = models.DateTimeField(blank=True,null=True)
|
||||
timezone = models.CharField(default='UTC',
|
||||
choices=timezones,
|
||||
#choices=timezones,
|
||||
max_length=100)
|
||||
distance = models.IntegerField(default=0)
|
||||
duration = models.TimeField(blank=True)
|
||||
@@ -3404,7 +3406,7 @@ class FollowerForm(ModelForm):
|
||||
fields = ['emailaddress']
|
||||
|
||||
# Virtual Race results (for keeping results when workouts are deleted)
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class VirtualRaceResult(models.Model):
|
||||
boatclasses = (type for type in mytypes.workouttypes if type[0] in mytypes.otwtypes)
|
||||
userid = models.IntegerField(default=0)
|
||||
@@ -3529,7 +3531,7 @@ class VirtualRaceResult(models.Model):
|
||||
)
|
||||
|
||||
# Virtual Race results (for keeping results when workouts are deleted)
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class IndoorVirtualRaceResult(models.Model):
|
||||
boatclasses = (type for type in mytypes.workouttypes if type[0] in mytypes.otetypes)
|
||||
userid = models.IntegerField(default=0) # ID of rower object
|
||||
@@ -3794,7 +3796,7 @@ class ergcpdata(models.Model):
|
||||
app_label = 'rowers'
|
||||
|
||||
# A wrapper around the png files
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class GraphImage(models.Model):
|
||||
filename = models.CharField(default='',max_length=150,blank=True,null=True)
|
||||
creationdatetime = models.DateTimeField()
|
||||
@@ -3856,7 +3858,9 @@ class WorkoutForm(ModelForm):
|
||||
label='Private')
|
||||
|
||||
self.fields['timezone'] = forms.ChoiceField(
|
||||
choices = [(x,x) for x in pytz.common_timezones]
|
||||
choices = (
|
||||
(x,x) for x in pytz.common_timezones
|
||||
)
|
||||
)
|
||||
|
||||
if 'instance' in kwargs:
|
||||
@@ -4547,7 +4551,7 @@ class SiteAnnouncement(models.Model):
|
||||
return super(SiteAnnouncement,self).save(*args, **kwargs)
|
||||
|
||||
# A comment by a user on a training
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class WorkoutComment(models.Model):
|
||||
comment = models.TextField(max_length=300)
|
||||
created = models.DateTimeField(default=timezone.now)
|
||||
@@ -4573,7 +4577,7 @@ class WorkoutCommentForm(ModelForm):
|
||||
}
|
||||
|
||||
# A comment by a user on a training
|
||||
@python_2_unicode_compatible
|
||||
|
||||
class PlannedSessionComment(models.Model):
|
||||
comment = models.TextField(max_length=300)
|
||||
created = models.DateTimeField(default=timezone.now)
|
||||
|
||||
@@ -23,7 +23,6 @@ import urllib
|
||||
import rowers.c2stuff as c2stuff
|
||||
|
||||
# Django
|
||||
from django.shortcuts import render_to_response
|
||||
from django.http import HttpResponseRedirect, HttpResponse,JsonResponse
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
|
||||
@@ -27,7 +27,6 @@ from uuid import uuid4
|
||||
from requests import ConnectionError
|
||||
|
||||
# Django
|
||||
from django.shortcuts import render_to_response
|
||||
from django.http import HttpResponseRedirect, HttpResponse,JsonResponse
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
|
||||
@@ -117,7 +117,7 @@ def get_workout(user,sporttracksid,do_async=False):
|
||||
data = s.json()
|
||||
|
||||
strokedata = pd.DataFrame.from_dict({
|
||||
key: pd.Series(value) for key, value in data.items()
|
||||
key: pd.Series(value,dtype='object') for key, value in data.items()
|
||||
})
|
||||
|
||||
id,message = add_workout_from_data(
|
||||
|
||||
+110
-61
@@ -16,7 +16,7 @@ import re
|
||||
from parameterized import parameterized
|
||||
from django.test import TestCase, Client,override_settings
|
||||
from django.core.management import call_command
|
||||
from django.utils.six import StringIO
|
||||
|
||||
from django.test.client import RequestFactory
|
||||
from rowers.views import c2_open
|
||||
from rowers.models import Workout, User, Rower, WorkoutForm,RowerForm,GraphImage
|
||||
@@ -761,7 +761,8 @@ def mocked_requests(*args, **kwargs):
|
||||
'available-user-data': []
|
||||
}
|
||||
|
||||
c2workoutlist = json.load(open('rowers/tests/testdata/c2workoutlist.txt'))
|
||||
with open('rowers/tests/testdata/c2workoutlist.txt') as f:
|
||||
c2workoutlist = json.load(f)
|
||||
|
||||
c2uploadjson = {
|
||||
"data": {
|
||||
@@ -782,29 +783,52 @@ def mocked_requests(*args, **kwargs):
|
||||
}
|
||||
}
|
||||
|
||||
stravaworkoutlist = json.load(open('rowers/tests/testdata/stravaworkoutlist.txt'))
|
||||
sporttracksworkoutlist = json.load(open('rowers/tests/testdata/sporttracksworkouts.txt'))
|
||||
with open('rowers/tests/testdata/stravaworkoutlist.txt') as f:
|
||||
stravaworkoutlist = json.load(f)
|
||||
|
||||
with open('rowers/tests/testdata/sporttracksworkouts.txt') as f:
|
||||
sporttracksworkoutlist = json.load(f)
|
||||
|
||||
#nkworkoutlist = json.load(open('rowers/tests/testdata/nkworkouts.txt'))
|
||||
|
||||
rkworkoutlistjson = json.load(open('rowers/tests/testdata/rkworkoutslist.txt','r'))
|
||||
uaworkoutlistjson = json.load(open('rowers/tests/testdata/uaworkoutlist.txt','r'))
|
||||
|
||||
stravasummaryjson = json.load(open('rowers/tests/testdata/stravaworkoutsummary.txt','r'))
|
||||
with open('rowers/tests/testdata/rkworkoutslist.txt','r') as f:
|
||||
rkworkoutlistjson = json.load(f)
|
||||
|
||||
stravatimejson = json.load(open('rowers/tests/testdata/stravatimetestdata.txt','r'))
|
||||
stravavelojson = json.load(open('rowers/tests/testdata/stravavelotestdata.txt','r'))
|
||||
with open('rowers/tests/testdata/uaworkoutlist.txt','r') as f:
|
||||
uaworkoutlistjson = json.load(f)
|
||||
|
||||
stravapowerjson = json.load(open('rowers/tests/testdata/stravapowertestdata.txt','r'))
|
||||
with open('rowers/tests/testdata/stravaworkoutsummary.txt','r') as f:
|
||||
stravasummaryjson = json.load(f)
|
||||
|
||||
stravadistancejson = json.load(open('rowers/tests/testdata/stravadistancetestdata.txt','r'))
|
||||
stravalatlongjson = json.load(open('rowers/tests/testdata/stravalatlongtestdata.txt','r'))
|
||||
stravahrjson = json.load(open('rowers/tests/testdata/stravahrtestdata.txt','r'))
|
||||
stravaspmjson = json.load(open('rowers/tests/testdata/stravaspmtestdata.txt','r'))
|
||||
with open('rowers/tests/testdata/stravatimetestdata.txt','r') as f:
|
||||
stravatimejson = json.load(f)
|
||||
|
||||
uapostworkoutjson = json.load(open('rowers/tests/testdata/uapostworkoutresponse.txt','r'))
|
||||
with open('rowers/tests/testdata/stravavelotestdata.txt','r') as f:
|
||||
stravavelojson = json.load(f)
|
||||
|
||||
tpuploadresponse = json.load(open('rowers/tests/testdata/tpuploadresponse.txt','r'))
|
||||
with open('rowers/tests/testdata/stravapowertestdata.txt','r') as f:
|
||||
stravapowerjson = json.load(f)
|
||||
|
||||
with open('rowers/tests/testdata/stravadistancetestdata.txt','r') as f:
|
||||
stravadistancejson = json.load(f)
|
||||
|
||||
with open('rowers/tests/testdata/stravalatlongtestdata.txt','r') as f:
|
||||
stravalatlongjson = json.load(f)
|
||||
|
||||
with open('rowers/tests/testdata/stravahrtestdata.txt','r') as f:
|
||||
stravahrjson = json.load(f)
|
||||
|
||||
with open('rowers/tests/testdata/stravaspmtestdata.txt','r') as f:
|
||||
stravaspmjson = json.load(f)
|
||||
|
||||
|
||||
with open('rowers/tests/testdata/uapostworkoutresponse.txt','r') as f:
|
||||
uapostworkoutjson = json.load(f)
|
||||
|
||||
|
||||
with open('rowers/tests/testdata/tpuploadresponse.txt','r') as f:
|
||||
tpuploadresponse = json.load(f)
|
||||
|
||||
stravastreamjson = {
|
||||
'time':stravatimejson,
|
||||
@@ -816,15 +840,23 @@ def mocked_requests(*args, **kwargs):
|
||||
'watts':stravapowerjson,
|
||||
}
|
||||
|
||||
ststrokesjson = json.load(open('rowers/tests/testdata/sporttracksstrokedata.txt','r'))
|
||||
ststrokesjson_nogps = json.load(open('rowers/tests/testdata/sporttracksstrokedatanolocation.txt','r'))
|
||||
with open('rowers/tests/testdata/sporttracksstrokedata.txt','r') as f:
|
||||
ststrokesjson = json.load(f)
|
||||
|
||||
rkstrokesjson = json.load(open('rowers/tests/testdata/rkstrokes.txt','r'))
|
||||
with open('rowers/tests/testdata/sporttracksstrokedatanolocation.txt','r') as f:
|
||||
ststrokesjson_nogps = json.load(f)
|
||||
|
||||
uastrokesjson = json.load(open('rowers/tests/testdata/uastrokes.txt','r'))
|
||||
uauserjson = json.load(open('rowers/tests/testdata/uauser.txt','r'))
|
||||
with open('rowers/tests/testdata/rkstrokes.txt','r') as f:
|
||||
rkstrokesjson = json.load(f)
|
||||
|
||||
stravaathletejson = json.load(open('rowers/tests/testdata/strava_athlete.txt'))
|
||||
with open('rowers/tests/testdata/uastrokes.txt','r') as f:
|
||||
uastrokesjson = json.load(f)
|
||||
|
||||
with open('rowers/tests/testdata/uauser.txt','r') as f:
|
||||
uauserjson = json.load(f)
|
||||
|
||||
with open('rowers/tests/testdata/strava_athlete.txt') as f:
|
||||
stravaathletejson = json.load(f)
|
||||
|
||||
class MockResponse:
|
||||
def __init__(self, json_data, status_code):
|
||||
@@ -852,10 +884,27 @@ def mocked_requests(*args, **kwargs):
|
||||
|
||||
class MockStreamResponse:
|
||||
def __init__(self, file_name, status_code):
|
||||
data = open(file_name,'rb')
|
||||
self.raw = data
|
||||
self.raw = open(file_name,'rb')
|
||||
self.status_code = status_code
|
||||
self.ok = True
|
||||
self.file_name = file_name
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.raw.close()
|
||||
|
||||
|
||||
def __delete__(self):
|
||||
self.raw.close()
|
||||
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
self.raw.close()
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
class MockOAuth1Session:
|
||||
def __init__(self,*args, **kwargs):
|
||||
@@ -937,93 +986,93 @@ def mocked_requests(*args, **kwargs):
|
||||
return MockResponse(jsonresponse,200)
|
||||
|
||||
|
||||
polartester = re.compile('.*?polaraccesslink\.com')
|
||||
c2tester = re.compile('.*?log\.concept2\.com')
|
||||
stravatester = re.compile('.*?strava\.com')
|
||||
sttester = re.compile('.*?sporttracks\.mobi')
|
||||
rktester = re.compile('.*?runkeeper\.com')
|
||||
uatester = re.compile('.*?mapmyfitness\.com')
|
||||
tptester = re.compile('.*?trainingpeaks\.com')
|
||||
nktester = re.compile('.*?nkrowlink\.com')
|
||||
rp3tester = re.compile('.*?rp3rowing-app\.com')
|
||||
garmintester = re.compile('.*?garmin\.com')
|
||||
fakturoidtester = re.compile('.*?fakturoid\.cz')
|
||||
polartester = re.compile(r'.*?polaraccesslink\.com')
|
||||
c2tester = re.compile(r'.*?log\.concept2\.com')
|
||||
stravatester = re.compile(r'.*?strava\.com')
|
||||
sttester = re.compile(r'.*?sporttracks\.mobi')
|
||||
rktester = re.compile(r'.*?runkeeper\.com')
|
||||
uatester = re.compile(r'.*?mapmyfitness\.com')
|
||||
tptester = re.compile(r'.*?trainingpeaks\.com')
|
||||
nktester = re.compile(r'.*?nkrowlink\.com')
|
||||
rp3tester = re.compile(r'.*?rp3rowing-app\.com')
|
||||
garmintester = re.compile(r'.*?garmin\.com')
|
||||
fakturoidtester = re.compile(r'.*?fakturoid\.cz')
|
||||
|
||||
c2importregex = '.*?concept2.com\/api\/users\/me\/results\/\d+'
|
||||
c2importregex = r'.*?concept2.com\/api\/users\/me\/results\/\d+'
|
||||
c2importtester = re.compile(c2importregex)
|
||||
|
||||
c2uploadregex = '.*?concept2.com\/api\/users\/\d+\/results$'
|
||||
c2uploadregex = r'.*?concept2.com\/api\/users\/\d+\/results$'
|
||||
c2uploadtester = re.compile(c2uploadregex)
|
||||
|
||||
c2strokesregex = '.*?concept2.com\/api\/users\/me\/results\/\d+\/strokes'
|
||||
c2strokesregex = r'.*?concept2.com\/api\/users\/me\/results\/\d+\/strokes'
|
||||
c2strokestester = re.compile(c2strokesregex)
|
||||
|
||||
c2workoutlistregex = '.*?concept2\.com\/api\/users\/me\/results\?page=\d'
|
||||
c2workoutlistregex = r'.*?concept2\.com\/api\/users\/me\/results\?page=\d'
|
||||
c2workoutlisttester = re.compile(c2workoutlistregex)
|
||||
|
||||
nkworkoutlistregex = '.*?nkrowlink\.com\/api\/v1\/sessions'
|
||||
nkworkoutlistregex = r'.*?nkrowlink\.com\/api\/v1\/sessions'
|
||||
nkworkoutlisttester = re.compile(nkworkoutlistregex)
|
||||
|
||||
nkstrokesregex = '.*?nkrowlink\.com\/api\/v1\/sessions\/strokes'
|
||||
nkstrokesregex = r'.*?nkrowlink\.com\/api\/v1\/sessions\/strokes'
|
||||
nkstrokestester = re.compile(nkstrokesregex)
|
||||
|
||||
rp3graphregex = '.*?rp3rowing-app\.com\/graphql'
|
||||
rp3graphregex = r'.*?rp3rowing-app\.com\/graphql'
|
||||
rp3graphtester = re.compile(rp3graphregex)
|
||||
|
||||
stravaathleteregex = '.*?strava\.com\/api\/v3\/athlete$'
|
||||
stravaathleteregex = r'.*?strava\.com\/api\/v3\/athlete$'
|
||||
stravaathletetester = re.compile(stravaathleteregex)
|
||||
|
||||
|
||||
stravaworkoutlistregex = '.*?strava\.com\/api\/v3\/athlete\/activities'
|
||||
stravaworkoutlistregex = r'.*?strava\.com\/api\/v3\/athlete\/activities'
|
||||
stravaworkoutlisttester = re.compile(stravaworkoutlistregex)
|
||||
|
||||
stravastreamregex = '.*?strava\.com\/api\/v3\/activities\/\d+\/streams\/(\w.*?)\?'
|
||||
stravastreamregex = r'.*?strava\.com\/api\/v3\/activities\/\d+\/streams\/(\w.*?)\?'
|
||||
stravastreamtester = re.compile(stravastreamregex)
|
||||
|
||||
stravasummaryregex = '.*?strava\.com\/api\/v3\/activities\/\d+$'
|
||||
stravasummaryregex = r'.*?strava\.com\/api\/v3\/activities\/\d+$'
|
||||
stravasummarytester = re.compile(stravasummaryregex)
|
||||
|
||||
stuploadregex = '.*?sporttracks\.mobi\/api\/v2\/fitnessActivities.json$'
|
||||
stuploadregex = r'.*?sporttracks\.mobi\/api\/v2\/fitnessActivities.json$'
|
||||
stuploadtester = re.compile(stuploadregex)
|
||||
|
||||
stworkoutlistregex = '.*?sporttracks\.mobi\/api\/v2\/fitnessActivities$'
|
||||
stworkoutlistregex = r'.*?sporttracks\.mobi\/api\/v2\/fitnessActivities$'
|
||||
stworkoutlisttester = re.compile(stworkoutlistregex)
|
||||
|
||||
ststrokesregex = '.*?sporttracks\.mobi\/api\/v2\/fitnessActivities/(\d+)$'
|
||||
ststrokesregex = r'.*?sporttracks\.mobi\/api\/v2\/fitnessActivities/(\d+)$'
|
||||
ststrokestester = re.compile(ststrokesregex)
|
||||
|
||||
rkuploadregex = '.*?api\.runkeeper\.com\/fitnessActivities$'
|
||||
rkuploadregex = r'.*?api\.runkeeper\.com\/fitnessActivities$'
|
||||
rkuploadtester = re.compile(rkuploadregex)
|
||||
rkuserregex = '.*?api\.runkeeper\.com\/user$'
|
||||
rkuserregex = r'.*?api\.runkeeper\.com\/user$'
|
||||
rkusertester = re.compile(rkuserregex)
|
||||
rkstrokesregex = '.*?api\.runkeeper\.com\/fitnessActivities/\d+$'
|
||||
rkstrokesregex = r'.*?api\.runkeeper\.com\/fitnessActivities/\d+$'
|
||||
rkstrokestester = re.compile(rkstrokesregex)
|
||||
|
||||
uaapiregex = '.*?api\.ua\.com'
|
||||
uaapiregex = r'.*?api\.ua\.com'
|
||||
uaapitester = re.compile(uaapiregex)
|
||||
|
||||
uauploadregex = '.*?api\.ua\.com\/v7.1\/workout\/$'
|
||||
uauploadregex = r'.*?api\.ua\.com\/v7.1\/workout\/$'
|
||||
uauploadtester = re.compile(uauploadregex)
|
||||
|
||||
uastrokesregex = '.*?api\.ua\.com\/v7.1\/workout\/\d+'
|
||||
uastrokesregex = r'.*?api\.ua\.com\/v7.1\/workout\/\d+'
|
||||
uastrokestester = re.compile(uastrokesregex)
|
||||
|
||||
ualistregex = '.*?api\.ua\.com\/v7.1\/workout\/\?user'
|
||||
ualistregex = r'.*?api\.ua\.com\/v7.1\/workout\/\?user'
|
||||
ualisttester = re.compile(ualistregex)
|
||||
|
||||
uauserregex = '.*?api\.ua\.com\/v7.1\/user\/self\/'
|
||||
uauserregex = r'.*?api\.ua\.com\/v7.1\/user\/self\/'
|
||||
uausertester = re.compile(uauserregex)
|
||||
|
||||
tpuploadregex = '.*?trainingpeaks\.com\/v1\/file'
|
||||
tpuploadregex = r'.*?trainingpeaks\.com\/v1\/file'
|
||||
tpuploadtester = re.compile(tpuploadregex)
|
||||
|
||||
garmindownloadregex = '.*?garmin\.com\/mockfile?id=1'
|
||||
garmindownloadregex = r'.*?garmin\.com\/mockfile?id=1'
|
||||
garmindownloadtester = re.compile(garmindownloadregex)
|
||||
|
||||
garmintrainingregex = '.*?garmin\.com\/training-api\/workout'
|
||||
garmintrainingregex = r'.*?garmin\.com\/training-api\/workout'
|
||||
garmintrainingtester = re.compile(garmintrainingregex)
|
||||
|
||||
garmintrainingscheduleregex = '.*?garmin\.com\/training-api\/schedule'
|
||||
garmintrainingscheduleregex = r'.*?garmin\.com\/training-api\/schedule'
|
||||
garmintrainingscheduletester = re.compile(garmintrainingscheduleregex)
|
||||
|
||||
if garmintester.match(args[0]):
|
||||
|
||||
@@ -32,7 +32,9 @@ from django.test import TestCase, Client,override_settings, RequestFactory, Tran
|
||||
|
||||
from django.core.management import call_command
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.utils.six import StringIO
|
||||
|
||||
from io import StringIO
|
||||
|
||||
from django.test.client import RequestFactory
|
||||
from rowers.views import c2_open, multi_compare_view
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from django.db import transaction
|
||||
nu = datetime.datetime.now()
|
||||
|
||||
from django.core.files import File
|
||||
from django.utils.six import BytesIO
|
||||
from io import BytesIO
|
||||
|
||||
from PIL import Image
|
||||
from io import StringIO
|
||||
|
||||
@@ -156,7 +156,7 @@ class CoursesTest(TestCase):
|
||||
|
||||
response = self.c.post('/rowers/courses/upload/', form_data, follow=True)
|
||||
|
||||
|
||||
|
||||
|
||||
self.assertRedirects(response, expected_url='/rowers/list-courses/',
|
||||
status_code=302,target_status_code=200)
|
||||
@@ -191,7 +191,7 @@ class CoursesTest(TestCase):
|
||||
response = self.c.get('/rowers/courses/1/downloadkml/')
|
||||
self.assertEqual(response.status_code,200)
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
response.get('Content-Disposition'),
|
||||
'attachment; filename="course_1.kml"'
|
||||
)
|
||||
|
||||
@@ -73,7 +73,9 @@ class GarminObjects(DjangoTestCase):
|
||||
w.delete()
|
||||
|
||||
def test_garmin_push_summaries(self):
|
||||
data = json.load(open('rowers/tests/testdata/garminsummarydata.txt','r'))
|
||||
|
||||
with open('rowers/tests/testdata/garminsummarydata.txt','r') as f:
|
||||
data = json.load(f)
|
||||
response = self.c.post('/rowers/garmin/summaries/',json.dumps(data),
|
||||
content_type="application/json")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -85,7 +87,8 @@ class GarminObjects(DjangoTestCase):
|
||||
self.assertEqual(ws.count(),3)
|
||||
|
||||
def test_garmin_push_details3(self):
|
||||
data = json.load(open('rowers/tests/testdata/garmindetail3.txt','r'))
|
||||
with open('rowers/tests/testdata/garmindetail3.txt','r') as f:
|
||||
data = json.load(f)
|
||||
response = self.c.post('/rowers/garmin/activities/',json.dumps(data),
|
||||
content_type='application/json')
|
||||
|
||||
@@ -99,7 +102,8 @@ class GarminObjects(DjangoTestCase):
|
||||
self.assertEqual(len(data),515)
|
||||
|
||||
def test_garmin_push_details4(self):
|
||||
data = json.load(open('rowers/tests/testdata/garmindetail4.txt','r'))
|
||||
with open('rowers/tests/testdata/garmindetail4.txt','r') as f:
|
||||
data = json.load(f)
|
||||
response = self.c.post('/rowers/garmin/activities/',json.dumps(data),
|
||||
content_type='application/json')
|
||||
|
||||
@@ -113,7 +117,8 @@ class GarminObjects(DjangoTestCase):
|
||||
self.assertEqual(len(data),18)
|
||||
|
||||
def test_garmin_push_details2(self):
|
||||
data = json.load(open('rowers/tests/testdata/garmindetail2.txt','r'))
|
||||
with open('rowers/tests/testdata/garmindetail2.txt','r') as f:
|
||||
data = json.load(f)
|
||||
response = self.c.post('/rowers/garmin/activities/',json.dumps(data),
|
||||
content_type='application/json')
|
||||
|
||||
@@ -126,7 +131,8 @@ class GarminObjects(DjangoTestCase):
|
||||
self.assertEqual(len(data),451)
|
||||
|
||||
def test_garmin_push_details1(self):
|
||||
data = json.load(open('rowers/tests/testdata/garmindetail1.txt','r'))
|
||||
with open('rowers/tests/testdata/garmindetail1.txt','r') as f:
|
||||
data = json.load(f)
|
||||
response = self.c.post('/rowers/garmin/activities/',json.dumps(data),
|
||||
content_type='application/json')
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ from rowingdata import rowingdata
|
||||
nu = datetime.datetime.now()
|
||||
|
||||
from django.core.files import File
|
||||
from django.utils.six import BytesIO
|
||||
|
||||
from PIL import Image
|
||||
from io import StringIO
|
||||
|
||||
@@ -119,6 +119,7 @@ class ViewTest(TestCase):
|
||||
'notes':'noot mies',
|
||||
}
|
||||
form = WorkoutForm(data=form_data)
|
||||
|
||||
self.assertTrue(form.is_valid())
|
||||
response = self.c.post('/rowers/workout/'+encoded1+'/edit/', form_data, follow=True)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -643,6 +644,7 @@ class ViewTest(TestCase):
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
f.close()
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
status_code=302,target_status_code=200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -679,6 +681,7 @@ class ViewTest(TestCase):
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
f.close()
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
status_code=302,target_status_code=200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -714,6 +717,7 @@ class ViewTest(TestCase):
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
f.close()
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
status_code=302,target_status_code=200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -751,6 +755,7 @@ class ViewTest(TestCase):
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
f.close()
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
status_code=302,target_status_code=200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -788,6 +793,7 @@ class ViewTest(TestCase):
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
f.close()
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
status_code=302,target_status_code=200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -823,6 +829,7 @@ class ViewTest(TestCase):
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
f.close()
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
status_code=302,target_status_code=200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -860,6 +867,7 @@ class ViewTest(TestCase):
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
f.close()
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
status_code=302,target_status_code=200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -897,6 +905,7 @@ class ViewTest(TestCase):
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
f.close()
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
status_code=302,target_status_code=200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -942,3 +951,5 @@ class ViewTest(TestCase):
|
||||
os.remove(f_to_be_deleted+'.gz')
|
||||
except (FileNotFoundError,OSError):
|
||||
pass
|
||||
|
||||
f.close()
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||
from django.utils import six
|
||||
|
||||
import six
|
||||
|
||||
class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
|
||||
def _make_hash_value(self, user, timestamp):
|
||||
|
||||
@@ -1617,9 +1617,7 @@ def plannedsessions_print_view(request,userid=0,startdatestring='',enddatestring
|
||||
def plannedsessions_manage_view(request,userid=0,
|
||||
initialsession=0):
|
||||
|
||||
is_ajax = False
|
||||
if request.is_ajax(): # pragma: no cover
|
||||
is_ajax = True
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
|
||||
@@ -414,9 +414,7 @@ def virtualevent_setlogo_view(request,id=0,logoid=0): # pragma: no cover
|
||||
# Image upload to virtual event
|
||||
@login_required()
|
||||
def virtualevent_uploadimage_view(request,id=0): # pragma: no cover
|
||||
is_ajax = False
|
||||
if request.is_ajax():
|
||||
is_ajax = True
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
|
||||
r = getrower(request.user)
|
||||
|
||||
@@ -519,9 +517,7 @@ def virtualevent_uploadimage_view(request,id=0): # pragma: no cover
|
||||
@login_required()
|
||||
@permission_required('course.change_course',fn=get_course_by_pk,raise_exception=True)
|
||||
def course_upload_replace_view(request,id=0):
|
||||
is_ajax = False
|
||||
if request.is_ajax(): # pragma: no cover
|
||||
is_ajax = True
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
|
||||
r = getrower(request.user)
|
||||
|
||||
@@ -649,9 +645,7 @@ def course_update_confirm(request,id=0,newid=0):
|
||||
# Course upload
|
||||
@login_required()
|
||||
def course_upload_view(request):
|
||||
is_ajax = False
|
||||
if request.is_ajax(): # pragma: no cover
|
||||
is_ajax = True
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
|
||||
r = getrower(request.user)
|
||||
|
||||
@@ -715,9 +709,7 @@ def course_upload_view(request):
|
||||
# Standards deactivate
|
||||
@login_required()
|
||||
def standard_deactivate_view(request,id=0):
|
||||
is_ajax = False
|
||||
if request.is_ajax(): # pragma: no cover
|
||||
is_ajax = True
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
|
||||
r = getrower(request.user)
|
||||
|
||||
@@ -762,10 +754,8 @@ def standards_download_view(request,id=0):
|
||||
# Standards upload
|
||||
@login_required()
|
||||
def standards_upload_view(request,id=0):
|
||||
is_ajax = False
|
||||
if request.is_ajax(): # pragma: no cover
|
||||
is_ajax = True
|
||||
r = getrower(request.user)
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
r = getrower(request.user)
|
||||
|
||||
if id != 0: # pragma: no cover
|
||||
collection = StandardCollection.objects.get(id=id)
|
||||
@@ -833,9 +823,7 @@ def standards_upload_view(request,id=0):
|
||||
|
||||
|
||||
def virtualevents_view(request):
|
||||
is_ajax = False
|
||||
if request.is_ajax(): # pragma: no cover
|
||||
is_ajax = True
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
|
||||
g = GeoIP2()
|
||||
ip = request.META.get('HTTP_X_REAL_IP','1.1.1.1')
|
||||
|
||||
@@ -4873,7 +4873,7 @@ def workout_map_view(request,id=0):
|
||||
# Image upload
|
||||
@permission_required('workout.change_workout',fn=get_workout_by_opaqueid,raise_exception=True)
|
||||
def workout_uploadimage_view(request,id): # pragma: no cover
|
||||
is_ajax = request_is_ajax(request)
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
|
||||
|
||||
r = getrower(request.user)
|
||||
@@ -5013,7 +5013,7 @@ def workout_add_chart_view(request,id,plotnr=1):
|
||||
@login_required
|
||||
@permission_required('workout.change_workout',fn=get_workout_by_opaqueid,raise_exception=True)
|
||||
def workout_toggle_ranking(request,id=0):
|
||||
is_ajax = request_is_ajax(request)
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
|
||||
|
||||
row = get_workout_by_opaqueid(request,id)
|
||||
@@ -5286,7 +5286,7 @@ def workout_upload_view(request,
|
||||
},
|
||||
raceid=0):
|
||||
|
||||
is_ajax = request_is_ajax(request)
|
||||
is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
|
||||
if settings.TESTING:
|
||||
is_ajax = False
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
from YamJam import yamjam
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
#from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
# Read configuration (passwords, keys, secrets) from YamJam configuration
|
||||
# You have to create your own config.yaml in the project directory
|
||||
@@ -47,6 +47,7 @@ ALLOWED_HOSTS = CFG['allowed_hosts']
|
||||
#OAUTH2_PROVIDER_REFRESH_TOKEN_MODEL = 'oauth2_provider.RefreshToken'
|
||||
#OAUTH2_PROVIDER_ACCESS_TOKEN_EXPIRE_SECONDS = 3600
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
# Application definition
|
||||
|
||||
@@ -139,6 +140,9 @@ TEMPLATES = [
|
||||
'context_processors.warning_message',
|
||||
'rowers.context_processors.braintree_merchant',
|
||||
],
|
||||
'libraries' : {
|
||||
'staticfiles': 'django.templatetags.static',
|
||||
}
|
||||
# 'loaders': [
|
||||
# 'django.template.loaders.app_directories.Loader',
|
||||
# ],
|
||||
@@ -229,10 +233,6 @@ LOCALE_PATHS = (
|
||||
# os.path.join(BASE_DIR, 'cvkbrno/locale'),
|
||||
)
|
||||
|
||||
LANGUAGES = (
|
||||
('cs',_(u'Czech')),
|
||||
('nl',_(u'Dutch'))
|
||||
)
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
LANGUAGE_COOKIE_NAME = 'wm_lang'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
class SurveyConfig(AppConfig):
|
||||
name = 'app'
|
||||
name = 'survey'
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ class Response(models.Model):
|
||||
video = models.BooleanField(default=False,verbose_name='Video Analysis')
|
||||
interval = models.BooleanField(default=False,verbose_name='Interval editor')
|
||||
|
||||
capabilities = models.NullBooleanField(default=None,null=True,blank=True,
|
||||
capabilities = models.BooleanField(default=None,null=True,blank=True,
|
||||
verbose_name='Did you get the capabilities and features that you expected out of Rowsandall')
|
||||
|
||||
fallshort = models.TextField(max_length=500,blank=True,verbose_name='Where did Rowsandall fall short of your expectations?')
|
||||
|
||||
Reference in New Issue
Block a user