diff --git a/flex/flex/db.sqlite3 b/flex/flex/db.sqlite3 index 682f0ae..4675ae6 100644 Binary files a/flex/flex/db.sqlite3 and b/flex/flex/db.sqlite3 differ diff --git a/flex/flex/flex/__pycache__/settings.cpython-36.pyc b/flex/flex/flex/__pycache__/settings.cpython-36.pyc index ebef3c1..4f52e0e 100644 Binary files a/flex/flex/flex/__pycache__/settings.cpython-36.pyc and b/flex/flex/flex/__pycache__/settings.cpython-36.pyc differ diff --git a/flex/flex/flex/settings.py b/flex/flex/flex/settings.py index 6732f59..52007ca 100644 --- a/flex/flex/flex/settings.py +++ b/flex/flex/flex/settings.py @@ -119,4 +119,4 @@ USE_TZ = True # https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_URL = '/static/' -LOGIN_REDIRECT_URL ='admin/' +LOGIN_REDIRECT_URL ='/home/dash' diff --git a/flex/flex/home/__pycache__/urls.cpython-36.pyc b/flex/flex/home/__pycache__/urls.cpython-36.pyc index 2d83621..325b541 100644 Binary files a/flex/flex/home/__pycache__/urls.cpython-36.pyc and b/flex/flex/home/__pycache__/urls.cpython-36.pyc differ diff --git a/flex/flex/home/__pycache__/views.cpython-36.pyc b/flex/flex/home/__pycache__/views.cpython-36.pyc index efd2b2c..bdd1ccb 100644 Binary files a/flex/flex/home/__pycache__/views.cpython-36.pyc and b/flex/flex/home/__pycache__/views.cpython-36.pyc differ diff --git a/flex/flex/home/static/home/calories.json b/flex/flex/home/static/home/calories.json new file mode 100644 index 0000000..d87e12b --- /dev/null +++ b/flex/flex/home/static/home/calories.json @@ -0,0 +1,165 @@ +{ + "bucket": [ + { + "startTimeMillis": "1515909198911", + "endTimeMillis": "1515995598911", + "dataset": [ + { + "dataSourceId": "derived:com.google.calories.expended:com.google.android.gms:aggregated", + "point": [ + { + "startTimeNanos": "1515909198911000000", + "originDataSourceId": "derived:com.google.calories.expended:com.google.android.gms:from_activities", + "endTimeNanos": "1515995598911000000", + "value": [ + { + "mapVal": [], + "fpVal": 1895.1171875 + } + ], + "dataTypeName": "com.google.calories.expended" + } + ] + } + ] + }, + { + "startTimeMillis": "1515995598911", + "endTimeMillis": "1516081998911", + "dataset": [ + { + "dataSourceId": "derived:com.google.calories.expended:com.google.android.gms:aggregated", + "point": [ + { + "startTimeNanos": "1515995598911000000", + "originDataSourceId": "derived:com.google.calories.expended:com.google.android.gms:from_activities", + "endTimeNanos": "1516081998911000000", + "value": [ + { + "mapVal": [], + "fpVal": 1949.4793701171875 + } + ], + "dataTypeName": "com.google.calories.expended" + } + ] + } + ] + }, + { + "startTimeMillis": "1516081998911", + "endTimeMillis": "1516168398911", + "dataset": [ + { + "dataSourceId": "derived:com.google.calories.expended:com.google.android.gms:aggregated", + "point": [ + { + "startTimeNanos": "1516081998911000000", + "originDataSourceId": "derived:com.google.calories.expended:com.google.android.gms:from_activities", + "endTimeNanos": "1516168398911000000", + "value": [ + { + "mapVal": [], + "fpVal": 2016.62353515625 + } + ], + "dataTypeName": "com.google.calories.expended" + } + ] + } + ] + }, + { + "startTimeMillis": "1516168398911", + "endTimeMillis": "1516254798911", + "dataset": [ + { + "dataSourceId": "derived:com.google.calories.expended:com.google.android.gms:aggregated", + "point": [ + { + "startTimeNanos": "1516168398911000000", + "originDataSourceId": "derived:com.google.calories.expended:com.google.android.gms:from_activities", + "endTimeNanos": "1516254798911000000", + "value": [ + { + "mapVal": [], + "fpVal": 2116.150146484375 + } + ], + "dataTypeName": "com.google.calories.expended" + } + ] + } + ] + }, + { + "startTimeMillis": "1516254798911", + "endTimeMillis": "1516341198911", + "dataset": [ + { + "dataSourceId": "derived:com.google.calories.expended:com.google.android.gms:aggregated", + "point": [ + { + "startTimeNanos": "1516254798911000000", + "originDataSourceId": "derived:com.google.calories.expended:com.google.android.gms:from_activities", + "endTimeNanos": "1516341198911000000", + "value": [ + { + "mapVal": [], + "fpVal": 2149.779296875 + } + ], + "dataTypeName": "com.google.calories.expended" + } + ] + } + ] + }, + { + "startTimeMillis": "1516341198911", + "endTimeMillis": "1516427598911", + "dataset": [ + { + "dataSourceId": "derived:com.google.calories.expended:com.google.android.gms:aggregated", + "point": [ + { + "startTimeNanos": "1516341198911000000", + "originDataSourceId": "derived:com.google.calories.expended:com.google.android.gms:from_activities", + "endTimeNanos": "1516427598911000000", + "value": [ + { + "mapVal": [], + "fpVal": 1994.624267578125 + } + ], + "dataTypeName": "com.google.calories.expended" + } + ] + } + ] + }, + { + "startTimeMillis": "1516427598911", + "endTimeMillis": "1516513998911", + "dataset": [ + { + "dataSourceId": "derived:com.google.calories.expended:com.google.android.gms:aggregated", + "point": [ + { + "startTimeNanos": "1516427598911000000", + "originDataSourceId": "derived:com.google.calories.expended:com.google.android.gms:from_activities", + "endTimeNanos": "1516500573415000000", + "value": [ + { + "mapVal": [], + "fpVal": 1553.27734375 + } + ], + "dataTypeName": "com.google.calories.expended" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/flex/flex/home/static/home/main2.css b/flex/flex/home/static/home/main2.css new file mode 100644 index 0000000..0ba9b03 --- /dev/null +++ b/flex/flex/home/static/home/main2.css @@ -0,0 +1,149 @@ +html { + margin: 0; + padding: 0; + height: 100%; + width: 100%; + position: relative; +} +title { + color: blue; +} +body { + margin: 0; + padding: 0; + position: relative; + height: 100%; + width: 100%; + background-image: url(https://images.unsplash.com/photo-1427384906349-30452365b5e8?auto=format&fit=crop&w=3134&q=80); + + background-repeat: no-repeat; + background-size: cover; + z-index: -1; + +} +#nav { + position: fixed; + top: 0; + background-color: grey; + opacity: .5; + width: 100%; + height: 100%; + z-index: 0; +} +div.navbar { + background: black; + width: 100%; + height: 50px; + color: white; + display: flex; + align-items: right; + justify-content: center; + padding-left: 425px; + position: absolute; + rgba = red blue green alpha. alpha is +} + +#profile-option { + position: relative; + top: 40%; + left: 50%; + margin-top: -50px; + margin-left: -50px; + opacity: 1; +} + +#icon{ + position: relative; + width:175px; + height: 185px; + opacity: 1; + border-radius: 35px; +} + + +#devam { + color: white; + font-size: 200%; + text-align: center; + text-shadow: 0px 0px 2px #000; +} + +a:hover { + text-decoration: none; +} + +.navbar .item{ + color: white; + font-size: 35px; + margin-left: +} +div.input { + margin: 0; + position: absolute; + padding: 0; + width: 100%; + height: 500px; +} + +p.title { + margin: 10; + padding: 0; + height: 120px; + width: 70%; + text-align: center; + position: absolute; + top: 12%; + left: 50%; + margin-right: -50%; + transform: translate(-50%, -50%); + font-family: 'Open Sans Condensed', sans-serif; + font-size: 200px; + color: #C0C0C0; + margin-top: 150px; + text-shadow: 0px 0px 2px #000; +} + + + font.title { + margin: 0; + padding-top: 5px; + height: 100px; + width: 70%; + text-align: center; + position: absolute; + top: 212%; + left: 50%; + margin-right: -50%; + transform: translate(-50%, -50%); + font-family: 'Courier New'; + font-size: 20px; + color: yellow; +} +.subtitle{ + margin: 10; + padding: 0; + height: 35px; + text-align: center; + position: absolute; + top: 12%; + left: 50%; + margin-right: -50%; + transform: translate(-50%, -50%); + font-family: 'Open Sans Condensed', sans-serif; + font-size: 50px; + color: #546E7A; + margin-top:330px; +} +html, html a { + -webkit-font-smoothing: antialiased; + text-shadow: 1px 1px 1px rgba(0,0,0,0.004); +} +p.legibility { + text-rendering: optimizeLegibility; +} +p.speed { + text-rendering: optimizeSpeed; +} +body { + text-rendering: optimizeLegibility; +} diff --git a/flex/flex/home/templates/home/home.html b/flex/flex/home/templates/home/home.html index 0b48d12..26dcab1 100644 --- a/flex/flex/home/templates/home/home.html +++ b/flex/flex/home/templates/home/home.html @@ -54,19 +54,14 @@ {% else %}


- +
{% endif %} - - - + {{ r }} + diff --git a/flex/flex/home/templates/home/login.html b/flex/flex/home/templates/home/login.html new file mode 100644 index 0000000..a3140ab --- /dev/null +++ b/flex/flex/home/templates/home/login.html @@ -0,0 +1,32 @@ + + + Reflex | Login + + {% load static %} + + + + + + + + + + + + + + + + +

+
+ +

Devam Shroff

+
+
+ + + \ No newline at end of file diff --git a/flex/flex/home/templates/registration/logged_out.html b/flex/flex/home/templates/registration/logged_out.html index c489b95..8f95e73 100644 --- a/flex/flex/home/templates/registration/logged_out.html +++ b/flex/flex/home/templates/registration/logged_out.html @@ -24,6 +24,6 @@

Logged out!


- + {% endblock %} \ No newline at end of file diff --git a/flex/flex/home/templates/registration/login.html b/flex/flex/home/templates/registration/login.html new file mode 100644 index 0000000..ba5fcaf --- /dev/null +++ b/flex/flex/home/templates/registration/login.html @@ -0,0 +1,11 @@ + +{% block title %}Login{% endblock %} + +{% block content %} +

Login

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} \ No newline at end of file diff --git a/flex/flex/home/urls.py b/flex/flex/home/urls.py index 8373dbe..ba6d125 100644 --- a/flex/flex/home/urls.py +++ b/flex/flex/home/urls.py @@ -6,4 +6,7 @@ appname = 'home' urlpatterns = [ path('', views.home, name='home'), path('signin', views.user_login, name='signin'), + path('log', views.log, name='log'), + path('dash', views.dash, name='dash'), + ] \ No newline at end of file diff --git a/flex/flex/home/views.py b/flex/flex/home/views.py index b888949..9fb6402 100644 --- a/flex/flex/home/views.py +++ b/flex/flex/home/views.py @@ -10,7 +10,6 @@ import json def home(request): module_dir = os.path.dirname(__file__) # get current directory file_path = os.path.join(module_dir, 'static/home/fit.json') - #json_file_name = '../../static/home/fit.json' raw_data = open(file_path, 'rt') my_data = json.load(raw_data) raw_data.close() @@ -19,8 +18,27 @@ def home(request): while i < len(my_data['bucket']): walk_data.append(my_data['bucket'][i]['dataset'][0]['point'][0]['value'][0]['intVal']) i = i+1 - #my_data['bucket'][0]['dataset'][0]['point'][0]['value'][0]['intVal'] - return render(request, 'home/home.html', {'r':walk_data}) + + file_path = os.path.join(module_dir, 'static/home/calories.json') + raw_data = open(file_path, 'rt') + my_data = json.load(raw_data) + raw_data.close() + calories_data = [] + i = 0 + while i < len(my_data['bucket']): + calories_data.append(my_data['bucket'][i]['dataset'][0]['point'][0]['value'][0]['fpVal']) + i = i+1 + + return render(request, 'home/home.html', + { + 'calories_data':calories_data, + 'walk_data':walk_data, + }) + +def log(request): + return render(request, 'home/login.html') + + def user_login(request): username = 'devam' @@ -29,7 +47,38 @@ def user_login(request): if auth_user is not None: login(request, auth_user) #return HttpResponse(request.user.username) - return redirect('home') # ----------- + return redirect('dash') # ----------- else: return HttpResponse("Unable to log in. User not found.
Please check superuser for more details.") - return HttpResponse("It's not supposed to come till here.") \ No newline at end of file + return HttpResponse("It's not supposed to come till here.") + + + +def dash(request): + + module_dir = os.path.dirname(__file__) # get current directory + file_path = os.path.join(module_dir, 'static/home/fit.json') + raw_data = open(file_path, 'rt') + my_data = json.load(raw_data) + raw_data.close() + walk_data = [] + i = 0 + while i < len(my_data['bucket']): + walk_data.append(my_data['bucket'][i]['dataset'][0]['point'][0]['value'][0]['intVal']) + i = i+1 + + file_path = os.path.join(module_dir, 'static/home/calories.json') + raw_data = open(file_path, 'rt') + my_data = json.load(raw_data) + raw_data.close() + calories_data = [] + i = 0 + while i < len(my_data['bucket']): + calories_data.append(my_data['bucket'][i]['dataset'][0]['point'][0]['value'][0]['fpVal']) + i = i+1 + + return render(request, 'home/home.html', + { + 'calories_data':calories_data, + 'walk_data':walk_data, + }) \ No newline at end of file diff --git a/flex/lib/python3.6/site-packages/django/contrib/admin/__pycache__/forms.cpython-36.pyc b/flex/lib/python3.6/site-packages/django/contrib/admin/__pycache__/forms.cpython-36.pyc index a906457..c79ea60 100644 Binary files a/flex/lib/python3.6/site-packages/django/contrib/admin/__pycache__/forms.cpython-36.pyc and b/flex/lib/python3.6/site-packages/django/contrib/admin/__pycache__/forms.cpython-36.pyc differ