Added login inermission page.

This commit is contained in:
Karthik Pullela
2018-01-21 03:26:07 -08:00
parent 06fe65eaa3
commit 6ef644ed69
14 changed files with 419 additions and 15 deletions
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -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'
Binary file not shown.
Binary file not shown.
+165
View File
@@ -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"
}
]
}
]
}
]
}
+149
View File
@@ -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;
}
+3 -8
View File
@@ -54,19 +54,14 @@
{% else %}
<p class="inputs">
<br>
<a href="{% url 'signin' %}"><button id="begin">BEGIN</button></a>
<a href="{% url 'log' %}"><button id="begin">BEGIN</button></a>
<br>
{% endif %}
<!--p class="inputs">
<br>
<a href="{% url 'logout' %}"><button id="begin">BEGIN</button></a>
<br>
</p-->
</div>
</div>
{{ r }}
<script type="text/javascript" src="indexJs.js"></script>
+32
View File
@@ -0,0 +1,32 @@
<html>
<head>
<title>Reflex | Login</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/home/main2.css' %}">
<link href="https://fonts.googleapis.com/css?family=Rubik" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div id= "nav">
</div>
<div id="profile-option">
<a href="{% url 'signin' %}"> <img src = "https://www.shareicon.net/download/2016/07/05/791214_man_512x512.png" id = "icon"></a>
<br> <p> <strong><span id="devam">Devam Shroff</span> </strong> </p>
<br>
</div>
</body>
</html>
@@ -24,6 +24,6 @@
<p>Logged out!</p>
<button id="begin"><a href="{% url 'home'%}">Home</a></button><br>
<button id="begin"><a href="{% url 'signin'%}">Sign-in</a></button>
<button id="begin"><a href="{% url 'log'%}">Sign-in</a></button>
{% endblock %}
</body>
@@ -0,0 +1,11 @@
{% block title %}Login{% endblock %}
{% block content %}
<h2>Login</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Login</button>
</form>
{% endblock %}
+3
View File
@@ -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'),
]
+54 -5
View File
@@ -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. <br>Please check superuser for more details.")
return HttpResponse("It's not supposed to come till here.")
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,
})