From 6ef644ed69b47443830131db204038084172af70 Mon Sep 17 00:00:00 2001 From: Karthik Pullela Date: Sun, 21 Jan 2018 03:26:07 -0800 Subject: [PATCH] Added login inermission page. --- flex/flex/db.sqlite3 | Bin 131072 -> 131072 bytes .../flex/__pycache__/settings.cpython-36.pyc | Bin 2313 -> 2317 bytes flex/flex/flex/settings.py | 2 +- .../flex/home/__pycache__/urls.cpython-36.pyc | Bin 333 -> 386 bytes .../home/__pycache__/views.cpython-36.pyc | Bin 1284 -> 2248 bytes flex/flex/home/static/home/calories.json | 165 ++++++++++++++++++ flex/flex/home/static/home/main2.css | 149 ++++++++++++++++ flex/flex/home/templates/home/home.html | 11 +- flex/flex/home/templates/home/login.html | 32 ++++ .../templates/registration/logged_out.html | 2 +- .../home/templates/registration/login.html | 11 ++ flex/flex/home/urls.py | 3 + flex/flex/home/views.py | 59 ++++++- .../admin/__pycache__/forms.cpython-36.pyc | Bin 1326 -> 1321 bytes 14 files changed, 419 insertions(+), 15 deletions(-) create mode 100644 flex/flex/home/static/home/calories.json create mode 100644 flex/flex/home/static/home/main2.css create mode 100644 flex/flex/home/templates/home/login.html create mode 100644 flex/flex/home/templates/registration/login.html diff --git a/flex/flex/db.sqlite3 b/flex/flex/db.sqlite3 index 682f0ae8b578a99495f827bdd64183651c6c09a4..4675ae63278f4e92ad832b045e76c2f79a854640 100644 GIT binary patch delta 196 zcmZo@;Am*zm>|W(XgX2G2}o{CI6RNv(9p`r)XKm@&&b@^+{}Ek(foFPLjx;gb1MTA zJtG5SOCyWTC+4^MDVUd5nC4d&8)YOF8yY5OS`=qz7N(ZxrI}_Irk5I2q;JlB$Id8* yWSqIFg=sY-t8XK#|W(Fn^+q6Oi1PaCjcSfrXW+xs`#ro}rPYvAOAFqxtRp1|}deBO^T{ zQ!{gO%gra|xB4lVRT-G)nimyjSmc+cWE*9srj=HdlvP=#8YG#dn;V;N&V9$uD26c3 x*wDhvvYL_Aw~^Ix`h)k33eBtDPha((QIMcX+i$;T{LYW$GO$t8AO2^Q2LQ}pKlA_q diff --git a/flex/flex/flex/__pycache__/settings.cpython-36.pyc b/flex/flex/flex/__pycache__/settings.cpython-36.pyc index ebef3c141a5a5a5c61d1b5d8884d03eeafeba5a8..4f52e0eb06efa2dabc55d06b5f11e0523f5ee8ba 100644 GIT binary patch delta 35 qcmeAa>J{QN=H=y@o}3cpyOC3jotsNPBR@A)KP9m^W3w9jV@3d@?Fsh) delta 31 mcmeAb>J;KM=H=yb+msyTxsg+hot-T)B{wrqf3p_*V@3deXb61( 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 2d836212c58ab0d0899bf89db201defab841cfd5..325b5411ad7ab5cdef4dcd8b14fcd0c40731e7dc 100644 GIT binary patch delta 156 zcmX@h)Woc8%*)FqT$B>U%E-X*m;niJ0ND;eTpTk|*;*}?F@+v`RXQogDGOCCZNZjHsEy^iK iEGbDX$}3*UP{a$8;GOs?T!072;$h-pVqxNA1VI3NIUsHT delta 104 zcmZo-KFg$R%*)I5)Hx+;BLf4&V<3hDHXzFZh>IO2DqC}=t)vQBFZ(Nl9u^UhztXB5t7aBJRo3jNv>SKqe0p4-*R$A0q%|rxf`B diff --git a/flex/flex/home/__pycache__/views.cpython-36.pyc b/flex/flex/home/__pycache__/views.cpython-36.pyc index efd2b2cf1283e84d0e9be0d30076fa23cb0e0afd..bdd1ccbb971a3c082a1e3a6a0f99835414da71ef 100644 GIT binary patch delta 1104 zcmc(dOK;Oa5XW~mj$=EoJ}GHaUZDk3)Ep3pB2-l%Zm1FhwNeF&Ox7i7ow$r09+68A z?S%t^%2&PsUxG7NuD)_WaNsjAvlS4IobYOYJD#208SVU!oKNG8Yvr=jM74Fp7UGK- z`6StEG^60S@o?H!&XL%vsG=&-T2;n<;g*k&Hmeqem^5#5XdRBfzp=#*>=+3sCza5c zE2!MQ`QmP3#&%*Tqb3evSG)tXl0v!)3kOB^fJjVb&xn2V>BmhG7ZagMNg>Ir@_Tuh zqg<8s;ZziRakt&peB;<*?ax)W{ASw=LhSm{$%XmtJ&GGvbQ;ETC+-EV%*wywTAU%XpL@ZsHq)Votfrq~^1zk4o4U1b2`BjIBx8y(%{axF zVVq{v7_*EyMxCL1Vx9El3_H#;&N0q2SU7lr!O|Id>pR>wbO|doBdsO*4_e}r?pWF~ x9&PB-b%iW2WEmhgP2WC}Qa4(w#k$!G)gbU!S%eXv9|IcFA{ARXt8V43%1_sy+>HPL delta 426 zcmYjMJxjw-6n!rrO`4{u7C$J~Dt4+vJBW*jh%VybVo?Z{@@%4sO`7uZqF4$Jx;PXm zaT5Q4zr#gW$G1B97o5DWi+z`SIGlU#;l7XA2cx=?&l|5z$No|f`bJYv0=^3!x5m|$ zsvM(QcKm!=&_Gh5_r>T1jekdXxgl~4CpT1md@qB~JQ~c!j4;2`@S@OdT==Yh6-PZ= zqKsnLjY2@==N06!tYkMItxNrr&B$HIVPS~Iy6#a!tV z=5ftQ-=#gQr5SmB$=1T#w#c-zHzepzD98RAqUH2ZZk87y5MdKrl7S7ZV+E>+>)4cN zCEZdURayZ<`l&o^E&`z|0#*TdmL$w;C$URuS%?!@7865=?I61Jd!=-wmNILg)~s}1 oKRYmmwJ1R3QZboY|Ig63!^lYjcSrmrgba = 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 a906457aa2994ee01b0cc120a7375560ddd668d7..c79ea607cef799e42790c5d39870e9bc71d91483 100644 GIT binary patch delta 411 zcmZutyH3ME5HxvM!6FGl1QPM6Xj0%SB2hvE=|G}@*1Fj1htj2$&nzY=c0@w!x~UgZq`|Zz3M5 zi9{mN%v6$J7FvUr;uwxCP!8(v zewV}UAv_lfAqqmGAk>lw530rL+YRWIKlSwXkT-pX0mJcsLgr2?II0eDA+4>|d^hy0 v8$HQ%nyq^(KN@FOw!fzQ!YEC?L79?Xb%#xMVi$B7*mENg*Mhxrw|V*pHb{4= delta 371 zcmZ3`e69WT76n|J^PG(AC zNoIbYYf({t(Jj7I5EY-BT3no%o?0BmS6ZA}l$V&B8lRS#nv)X6QvLlHmF%wGli1x1-MTI7o z1}Rl3RhGpj7TG42xt3-o20)OWryrtUkXfLcRGOKSqFYv3l9^OwlBA!Km6(^FKUsu% zH6zdD1I!YlfCRY?2 m#4bq4OkTmF!WcFAEQ`Fn7)TQvhydwCvKHjsB7w==ta1RK&|(k(